Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c75acdc authored by Wei Yongjun's avatar Wei Yongjun Committed by Mark Brown
Browse files

pinctrl: st: fix return value check



In case of error, the function pinctrl_register() returns
NULL not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.
The function syscon_regmap_lookup_by_phandle() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 701016c0
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -1299,9 +1299,9 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
		return -ENOMEM;
		return -ENOMEM;


	info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
	info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
	if (!info->regmap) {
	if (IS_ERR(info->regmap)) {
		dev_err(info->dev, "No syscfg phandle specified\n");
		dev_err(info->dev, "No syscfg phandle specified\n");
		return -ENOMEM;
		return PTR_ERR(info->regmap);
	}
	}
	info->data = of_match_node(st_pctl_of_match, np)->data;
	info->data = of_match_node(st_pctl_of_match, np)->data;


@@ -1376,9 +1376,9 @@ static int st_pctl_probe(struct platform_device *pdev)
	pctl_desc->name		= dev_name(&pdev->dev);
	pctl_desc->name		= dev_name(&pdev->dev);


	info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
	info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
	if (IS_ERR(info->pctl)) {
	if (!info->pctl) {
		dev_err(&pdev->dev, "Failed pinctrl registration\n");
		dev_err(&pdev->dev, "Failed pinctrl registration\n");
		return PTR_ERR(info->pctl);
		return -EINVAL;
	}
	}


	for (i = 0; i < info->nbanks; i++)
	for (i = 0; i < info->nbanks; i++)