diff mbox series

[v2] phy: ocelot-serdes: Fix IS_ERR() vs NULL bug in serdes_probe()

Message ID 20241101061145.2282501-1-ruanjinjie@huawei.com
State New
Headers show
Series [v2] phy: ocelot-serdes: Fix IS_ERR() vs NULL bug in serdes_probe() | expand

Commit Message

Jinjie Ruan Nov. 1, 2024, 6:11 a.m. UTC
dev_get_regmap() call can return a null pointer. It will not return
error pointers. Thus apply a null pointer check instead.

Cc: stable@vger.kernel.org
Fixes: 672faa7bbf60 ("phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration")
Acked-by: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
v2:
- Add Acked-by.
- Update the commit message as Markus suggested.
---
 drivers/phy/mscc/phy-ocelot-serdes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jinjie Ruan Nov. 7, 2024, 1:27 a.m. UTC | #1
Gentle ping.

On 2024/11/1 14:11, Jinjie Ruan wrote:
> dev_get_regmap() call can return a null pointer. It will not return
> error pointers. Thus apply a null pointer check instead.
> 
> Cc: stable@vger.kernel.org
> Fixes: 672faa7bbf60 ("phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration")
> Acked-by: Colin Foster <colin.foster@in-advantage.com>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> v2:
> - Add Acked-by.
> - Update the commit message as Markus suggested.
> ---
>  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]);
Krzysztof Kozlowski Nov. 8, 2024, 11:13 a.m. UTC | #2
On 07/11/2024 02:27, Jinjie Ruan wrote:
> Gentle ping.
> 
> On 2024/11/1 14:11, Jinjie Ruan wrote:

After seven days? Really? Limit is two weeks but anyway better relax,
and help out by reviewing other patches on the mailing lists in order to
relieve the burden of maintainers and move your patches higher up the list.

Best regards,
Krzysztof
diff mbox series

Patch

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]);