* [PATCH] phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
@ 2024-10-31 12:38 Jinjie Ruan
2024-10-31 14:31 ` Colin Foster
2024-10-31 16:59 ` [PATCH] " Markus Elfring
0 siblings, 2 replies; 7+ messages in thread
From: Jinjie Ruan @ 2024-10-31 12:38 UTC (permalink / raw)
To: vkoul, kishon, linus.walleij, treding, florian.fainelli,
krzysztof.kozlowski, colin.foster, davem, linux-phy, linux-kernel
Cc: ruanjinjie
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
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
2024-10-31 12:38 [PATCH] phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe() Jinjie Ruan
@ 2024-10-31 14:31 ` Colin Foster
2024-10-31 17:15 ` Markus Elfring
2024-10-31 16:59 ` [PATCH] " Markus Elfring
1 sibling, 1 reply; 7+ messages in thread
From: Colin Foster @ 2024-10-31 14:31 UTC (permalink / raw)
To: Jinjie Ruan
Cc: vkoul, kishon, linus.walleij, treding, florian.fainelli,
krzysztof.kozlowski, davem, linux-phy, linux-kernel
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
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
2024-10-31 14:31 ` Colin Foster
@ 2024-10-31 17:15 ` Markus Elfring
2024-10-31 17:46 ` Colin Foster
0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2024-10-31 17:15 UTC (permalink / raw)
To: Colin Foster, Jinjie Ruan, linux-phy, David S. Miller,
Florian Fainelli, Kishon Vijay Abraham I, Krzysztof Kozlowski,
Linus Walleij, Thierry Reding, Vinod Koul
Cc: LKML
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
2024-10-31 17:15 ` Markus Elfring
@ 2024-10-31 17:46 ` Colin Foster
2024-10-31 18:09 ` Markus Elfring
0 siblings, 1 reply; 7+ messages in thread
From: Colin Foster @ 2024-10-31 17:46 UTC (permalink / raw)
To: Markus Elfring
Cc: Jinjie Ruan, linux-phy, David S. Miller, Florian Fainelli,
Kishon Vijay Abraham I, Krzysztof Kozlowski, Linus Walleij,
Thierry Reding, Vinod Koul, LKML
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
2024-10-31 17:46 ` Colin Foster
@ 2024-10-31 18:09 ` Markus Elfring
2024-10-31 18:22 ` Colin Foster
0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2024-10-31 18:09 UTC (permalink / raw)
To: Colin Foster, Jinjie Ruan, linux-phy, David S. Miller,
Florian Fainelli, Kishon Vijay Abraham I, Krzysztof Kozlowski,
Linus Walleij, Thierry Reding, Vinod Koul
Cc: LKML
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
2024-10-31 18:09 ` Markus Elfring
@ 2024-10-31 18:22 ` Colin Foster
0 siblings, 0 replies; 7+ messages in thread
From: Colin Foster @ 2024-10-31 18:22 UTC (permalink / raw)
To: Markus Elfring
Cc: Jinjie Ruan, linux-phy, David S. Miller, Florian Fainelli,
Kishon Vijay Abraham I, Krzysztof Kozlowski, Linus Walleij,
Thierry Reding, Vinod Koul, LKML
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe()
2024-10-31 12:38 [PATCH] phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe() Jinjie Ruan
2024-10-31 14:31 ` Colin Foster
@ 2024-10-31 16:59 ` Markus Elfring
1 sibling, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2024-10-31 16:59 UTC (permalink / raw)
To: Jinjie Ruan, linux-phy, Colin Foster, David S. Miller,
Florian Fainelli, Kishon Vijay Abraham I, Krzysztof Kozlowski,
Linus Walleij, Thierry Reding, Vinod Koul
Cc: LKML
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-10-31 18:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 12:38 [PATCH] phy: ocelot-serdes: Fix IS_ERR vs NULL bug in serdes_probe() Jinjie Ruan
2024-10-31 14:31 ` Colin Foster
2024-10-31 17:15 ` Markus Elfring
2024-10-31 17:46 ` Colin Foster
2024-10-31 18:09 ` Markus Elfring
2024-10-31 18:22 ` Colin Foster
2024-10-31 16:59 ` [PATCH] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox