diff mbox series

[net-next] can: flexcan: flexcan_chip_start(): fix the error return code in flexcan_setup_stop_mode()

Message ID 1543904780-30235-1-git-send-email-weiyongjun1@huawei.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show
Series [net-next] can: flexcan: flexcan_chip_start(): fix the error return code in flexcan_setup_stop_mode() | expand

Commit Message

Wei Yongjun Dec. 4, 2018, 6:26 a.m. UTC
The error return code PTR_ERR(gpr_np) is always 0 since gpr_np is
equal to NULL in this error handling case. Fix it by return -ENOENT.

Fixes: de3578c198c6 ("can: flexcan: add self wakeup support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/can/flexcan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Aisheng Dong Dec. 4, 2018, 12:32 p.m. UTC | #1
> -----Original Message-----
> From: Wei Yongjun [mailto:weiyongjun1@huawei.com]
> Sent: Tuesday, December 4, 2018 2:26 PM
> To: Wolfgang Grandegger <wg@grandegger.com>; Marc Kleine-Budde
> <mkl@pengutronix.de>; Aisheng DONG <aisheng.dong@nxp.com>
> Cc: Wei Yongjun <weiyongjun1@huawei.com>; linux-can@vger.kernel.org;
> netdev@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH net-next] can: flexcan: flexcan_chip_start(): fix the error return
> code in flexcan_setup_stop_mode()
> 
> The error return code PTR_ERR(gpr_np) is always 0 since gpr_np is equal to
> NULL in this error handling case. Fix it by return -ENOENT.
> 
> Fixes: de3578c198c6 ("can: flexcan: add self wakeup support")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/net/can/flexcan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index
> 0f36eaf..f412d84 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -1432,7 +1432,7 @@ static int flexcan_setup_stop_mode(struct
> platform_device *pdev)
>  	gpr_np = of_find_node_by_phandle(phandle);
>  	if (!gpr_np) {
>  		dev_dbg(&pdev->dev, "could not find gpr node by phandle\n");
> -		return PTR_ERR(gpr_np);
> +		return -ENOENT;

Good catch.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Dong Aisheng

>  	}
> 
>  	priv = netdev_priv(dev);
> 
>
Aisheng Dong Dec. 4, 2018, 12:35 p.m. UTC | #2
Copy Joakim.

> > From: Wei Yongjun [mailto:weiyongjun1@huawei.com]
[...]
> > Subject: [PATCH net-next] can: flexcan: flexcan_chip_start(): fix the
> > error return code in flexcan_setup_stop_mode()
> >
> > The error return code PTR_ERR(gpr_np) is always 0 since gpr_np is
> > equal to NULL in this error handling case. Fix it by return -ENOENT.
> >
> > Fixes: de3578c198c6 ("can: flexcan: add self wakeup support")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/net/can/flexcan.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> > index
> > 0f36eaf..f412d84 100644
> > --- a/drivers/net/can/flexcan.c
> > +++ b/drivers/net/can/flexcan.c
> > @@ -1432,7 +1432,7 @@ static int flexcan_setup_stop_mode(struct
> > platform_device *pdev)
> >  	gpr_np = of_find_node_by_phandle(phandle);
> >  	if (!gpr_np) {
> >  		dev_dbg(&pdev->dev, "could not find gpr node by phandle\n");
> > -		return PTR_ERR(gpr_np);
> > +		return -ENOENT;
> 
> Good catch.
> 
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> 
> Regards
> Dong Aisheng
> 
> >  	}
> >
> >  	priv = netdev_priv(dev);
> >
> >
diff mbox series

Patch

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 0f36eaf..f412d84 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1432,7 +1432,7 @@  static int flexcan_setup_stop_mode(struct platform_device *pdev)
 	gpr_np = of_find_node_by_phandle(phandle);
 	if (!gpr_np) {
 		dev_dbg(&pdev->dev, "could not find gpr node by phandle\n");
-		return PTR_ERR(gpr_np);
+		return -ENOENT;
 	}
 
 	priv = netdev_priv(dev);