Subject: Re: [PATCH] net: phy: Fix premature resume by a PHY driver

From: Abid Ali <[email-masked]>
Date: Mon, 21 Jul 2025 06:07:57 +0000

Hi Dan,

On Sun, Jul 20, 2025 at 21:09:19 +0300, Dan Carpenter wrote:
> smatch warnings:
> drivers/net/phy/phy_device.c:1852 __phy_resume() error: we previously assumed 'phydrv->resume' could be null (see line 1849)
>
> vim +1852 drivers/net/phy/phy_device.c
>
> 9421d84b1b3e16 Abid Ali              2025-07-18 @1849  	if (!phydrv || !phydrv->resume && phydev->suspended)
>                                                                        ^^^^^^^^^^^^^^^
> This checks for if the resume pointer is NULL, but if the resume is
> NULL but suspend is also NULL.  I'm surprised that the compiler allows
> us to write that comparison without adding parenthesis.  I thought that
> it would complain about && having higher precedence.
>
> 8a8f8281e7e7a8 Heiner Kallweit       2020-03-26 @1852  	ret = phydrv->resume(phydev);
>                                                               ^^^^^^^^^^^^^^
> Then this will crash.

yea, there is an obvious error here and have pointed it in the thread.
I have not gone forward with the V2 for now as we there are other concerns
thats not easy to address.
LINK: https://lore.kernel.org/netdev/[email-masked]/

For now the idea is to deal with issue pointed in the commit in the driver`s
resume callback itself.