Smatch report for drivers/net/phy/marvell10g.c

Marek Vasut marek.vasut at mailbox.org
Wed Aug 6 17:36:27 CEST 2025


On 8/6/25 4:53 PM, Tom Rini wrote:
> On Tue, Aug 05, 2025 at 05:30:49PM +0100, Andrew Goodbody wrote:
> 
>> I have these Smatch reports.
>>
>> drivers/net/phy/marvell10g.c:384 mv3310_select_mactype() warn: was ||
>> intended here instead of &&?
>> drivers/net/phy/marvell10g.c:387 mv3310_select_mactype() warn: was ||
>> intended here instead of &&?
>> drivers/net/phy/marvell10g.c:390 mv3310_select_mactype() warn: was ||
>> intended here instead of &&?
>>
>> Now there is obviously incorrect code there as it cannot work correctly as
>> is, phydev->interface cannot equal two different enums at the same time, but
>> simply swapping the && for || is not going to work either. Could anyone
>> please point me in the direction of a fix?
> 
> Adding Marek as r8a779f0_spider and r8a779f4_s4sk are the only two
> boards which enable CONFIG_PHY_MARVELL_10G (aside, ./tools/qconfig.py -b
> and then ./tools/qconfig.py -f CONFIG_FOO is handy to see what boards
> enable a given option and helpful when get_maintainer.pl has nothing
> specific).
They use the 2xxx series PHY, so this code is avoided. However, it seems 
even linux-next has the same behavior in .select_mactype() callback . 
They use test_bit() in there, but otherwise also use && instead of || 
which looks odd. Maybe that is a genuine bug which got ported over from 
Linux and needs to be fixed both there and here ?


More information about the U-Boot mailing list