pinctrl: berlin: fix return value for dev_get_regmap
PATCH 1/1 pinctrl: berlin: fix return value for dev_get_regmap
The failure value of dev_get_regmap is NULL. Hence, the return value is changed to -ENODEV.
A simplified version of the semantic match that finds this problem is as follows:
// <smpl>
@@
expression e1;
@@
* if (!e1)
return PTR_ERR(e1);
// </smpl>
Signed-off-by Himangi Saraogi <[email protected]>
Acked-by Julia Lawall <[email protected]>
--- drivers/pinctrl/berlin/berlin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/berlin/berlin.c +1 -1
@@ -320,7 +320,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev, regmap =dev_get_regmap (&pdev->dev,NULL );if (!regmap) -return PTR_ERR (regmap); +return -ENODEV ; pctrl =devm_kzalloc (dev,sizeof (*pctrl),GFP_KERNEL );if (!pctrl)
Signature · 1 line
1.9.1
Quoted 11 lines · Himangi Saraogi
The failure value of
dev_get_regmapis NULL. Hence, the return value is changed to-ENODEV.A simplified version of the semantic match that finds this problem is as follows:
// <smpl>
@@
expression e1;
@@
Quoted 7 lines
* if (!e1)
returnPTR_ERR(e1);// </smpl>
Signed-off-by Himangi Saraogi <[email protected]>Acked-by Julia Lawall <[email protected]>
Himangi,
thanks for the fix, but we already have a similar patch [1] pending.
Sebastian
[1] http://www.spinics.net/lists/linux-kernel-janitors/msg19125.html
Quoted 18 lines
--- drivers/pinctrl/berlin/berlin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/berlin/berlin.c +1
-1@@ -320,7 +320,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev, regmap =dev_get_regmap (&pdev->dev,NULL );if (!regmap) -return PTR_ERR (regmap); +return -ENODEV ; pctrl =devm_kzalloc (dev,sizeof (*pctrl),GFP_KERNEL );if (!pctrl)