Re: [PATCH v3 net-next] net: phy: micrel: Fix warn: passing zero to PTR_ERR

From: Horatiu Vultur - M31836
Date: Thu Dec 01 2022 - 03:21:25 EST


The 12/01/2022 07:08, Divya Koppera - I30481 wrote:
> Hi Horatiu,
>
> > -----Original Message-----
> > From: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
> > Sent: Wednesday, November 30, 2022 8:21 PM
> > To: Divya Koppera - I30481 <Divya.Koppera@xxxxxxxxxxxxx>
> > Cc: andrew@xxxxxxx; hkallweit1@xxxxxxxxx; linux@xxxxxxxxxxxxxxx;
> > davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx;
> > pabeni@xxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-
> > kernel@xxxxxxxxxxxxxxx; richardcochran@xxxxxxxxx; UNGLinuxDriver
> > <UNGLinuxDriver@xxxxxxxxxxxxx>; Madhuri Sripada - I34878
> > <Madhuri.Sripada@xxxxxxxxxxxxx>
> > Subject: Re: [PATCH v3 net-next] net: phy: micrel: Fix warn: passing zero to
> > PTR_ERR
> >
> > The 11/29/2022 15:46, Divya Koppera wrote:
> >
> > Hi Divya,
> >
> > > Handle the NULL pointer case
> > >
> > > Fixes New smatch warnings:
> > > drivers/net/phy/micrel.c:2613 lan8814_ptp_probe_once() warn: passing
> > zero to 'PTR_ERR'
> > >
> > > Fixes Old smatch warnings:
> > > drivers/net/phy/micrel.c:1750 ksz886x_cable_test_get_status() error:
> > > uninitialized symbol 'ret'.
> >
> > Shouldn't you split this patch in 2 different patches, as you fix 2 issues.
>
> I got these warnings in single mail, so thought of fixing it in one patch. Also, one patch has single line change so did this way.
> Yeah, splitting sense good, will do in next revision.
>
> > Also any reason why you target net-next and not net? Because I can see the
> > blamed patches on net branch.
> >
>
> Initially I targeted for net-next and in second revision I moved to net as it is fix. But I got a comment as below. So again, targeted to net-next.
>
> "
> > v1 -> v2:
> > - Handled NULL pointer case
> > - Changed subject line with net-next to net
>
> This is not a genuine bug fix, and so it should target next-next."

That is fine by me.

...

> > >
> > >
> > > static void lan8814_ptp_init(struct phy_device *phydev) {
> > > + struct lan8814_shared_priv *shared_priv = phydev->shared->priv;
> > > struct kszphy_priv *priv = phydev->priv;
> > > struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv;
> > > u32 temp;
> > >
> > > - if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK) ||
> > > - !IS_ENABLED(CONFIG_NETWORK_PHY_TIMESTAMPING))
> > > + /* Check if PHC support is missing at the configuration level */
> > > + if (!shared_priv->ptp_clock)
> > > return;

Sorry I forgot to mention this in the previous email.
Can you rename shared_priv to just shared. Because in all the other places
it is used shared and not shared_priv.

--
/Horatiu