can: flexcan: fix 'passing zero to ERR_PTR()' warning

This change “can: flexcan: fix ‘passing zero to ERR_PTR()’ warning” in Linux kernel is authored by YueHaibing <yuehaibing [at]> on Wed Dec 12 17:24:01 2018 +0800.

can: flexcan: fix 'passing zero to ERR_PTR()' warning

Fix a static code checker warning:
drivers/net/can/flexcan.c:1435 flexcan_setup_stop_mode() warn: passing zero to 'PTR_ERR'

Fixes: de3578c198c6 ("can: flexcan: add self wakeup support")
Signed-off-by: YueHaibing <>
Signed-off-by: Marc Kleine-Budde <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 7873e98.

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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..5f09764 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 phandlen");
-		return PTR_ERR(gpr_np);
+		return -ENODEV;
 	priv = netdev_priv(dev);

The commit for this change in Linux stable tree is 7873e98 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *