Message ID | 20241031123847.1356808-1-ruanjinjie@huawei.com |
---|---|
State | New |
Headers | show |
Series | phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe() | expand |
On Thu, Oct 31, 2024 at 08:38:47PM +0800, Jinjie Ruan wrote: > dev_get_regmap() return NULL and never return ERR_PTR(). > check NULL to fix it. > > Cc: stable@vger.kernel.org > Fixes: 672faa7bbf60 ("phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration") > Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> > --- > drivers/phy/mscc/phy-ocelot-serdes.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c > index 1cd1b5db2ad7..77ca67ce6e91 100644 > --- a/drivers/phy/mscc/phy-ocelot-serdes.c > +++ b/drivers/phy/mscc/phy-ocelot-serdes.c > @@ -512,8 +512,8 @@ static int serdes_probe(struct platform_device *pdev) > res->name); > } > > - if (IS_ERR(ctrl->regs)) > - return PTR_ERR(ctrl->regs); > + if (!ctrl->regs) > + return -EINVAL; > > for (i = 0; i < SERDES_MAX; i++) { > ret = serdes_phy_create(ctrl, i, &ctrl->phys[i]); > -- > 2.34.1 > Good find. Acked-by: colin.foster@in-advantage.com Revieved-by: colin.foster@in-advantage.com
> dev_get_regmap() return NULL and never return ERR_PTR(). call can return a null pointer. It will not return error pointers. > check NULL to fix it. Thus apply a null pointer check instead. Regards, Markus
> Good find. > > Acked-by: colin.foster@in-advantage.com > Revieved-by: colin.foster@in-advantage.com Please reconsider the usage of these tags once more. * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc5#n456 * Should a personal name be mentioned (besides the email address)? Regards, Markus
On Thu, Oct 31, 2024 at 06:15:09PM +0100, Markus Elfring wrote: > > Good find. > > > > Acked-by: colin.foster@in-advantage.com > > Revieved-by: colin.foster@in-advantage.com > > Please reconsider the usage of these tags once more. > > * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc5#n456 > > * Should a personal name be mentioned (besides the email address)? > You're absolutely right. Apologies. Acked-by: Colin Foster <colin.foster@in-advantage.com> Revieved-by: Colin Foster <colin.foster@in-advantage.com> > > Regards, > Markus
> You're absolutely right. Apologies. > > Acked-by: Colin Foster <colin.foster@in-advantage.com> > Revieved-by: Colin Foster <colin.foster@in-advantage.com> Please choose one of these tags (without a typo). Regards, Markus
On Thu, Oct 31, 2024 at 07:09:17PM +0100, Markus Elfring wrote: > > You're absolutely right. Apologies. > > > > Acked-by: Colin Foster <colin.foster@in-advantage.com> > > Revieved-by: Colin Foster <colin.foster@in-advantage.com> > Please choose one of these tags (without a typo). Sigh... Today is not my day. I don't know if there are any actions for me at this point. If there are please let me know.
diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c index 1cd1b5db2ad7..77ca67ce6e91 100644 --- a/drivers/phy/mscc/phy-ocelot-serdes.c +++ b/drivers/phy/mscc/phy-ocelot-serdes.c @@ -512,8 +512,8 @@ static int serdes_probe(struct platform_device *pdev) res->name); } - if (IS_ERR(ctrl->regs)) - return PTR_ERR(ctrl->regs); + if (!ctrl->regs) + return -EINVAL; for (i = 0; i < SERDES_MAX; i++) { ret = serdes_phy_create(ctrl, i, &ctrl->phys[i]);
dev_get_regmap() return NULL and never return ERR_PTR(). check NULL to fix it. Cc: stable@vger.kernel.org Fixes: 672faa7bbf60 ("phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration") Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- drivers/phy/mscc/phy-ocelot-serdes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)