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

Commit 41470c37 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Walleij
Browse files

pinctrl: sprd: check for allocation failure



devm_pinctrl_get() could fail with ERR_PTR(-ENOMEM) so I have added a
check for that.  I also reversed the other IS_ERR() test because it was
a little confusing to test one way and then the opposite a couple lines
later.

Fixes: 41d32cfc ("pinctrl: sprd: Add Spreadtrum pin control driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent baec7e68
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1100,11 +1100,15 @@ int sprd_pinctrl_remove(struct platform_device *pdev)

void sprd_pinctrl_shutdown(struct platform_device *pdev)
{
	struct pinctrl *pinctl = devm_pinctrl_get(&pdev->dev);
	struct pinctrl *pinctl;
	struct pinctrl_state *state;

	pinctl = devm_pinctrl_get(&pdev->dev);
	if (IS_ERR(pinctl))
		return;
	state = pinctrl_lookup_state(pinctl, "shutdown");
	if (!IS_ERR(state))
	if (IS_ERR(state))
		return;
	pinctrl_select_state(pinctl, state);
}