mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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: 41d32cfce1 ("pinctrl: sprd: Add Spreadtrum pin control driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
baec7e687a
commit
41470c379b
1 changed files with 7 additions and 3 deletions
|
|
@ -1100,12 +1100,16 @@ 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))
|
||||
pinctrl_select_state(pinctl, state);
|
||||
if (IS_ERR(state))
|
||||
return;
|
||||
pinctrl_select_state(pinctl, state);
|
||||
}
|
||||
|
||||
MODULE_DESCRIPTION("SPREADTRUM Pin Controller Driver");
|
||||
|
|
|
|||
Loading…
Reference in a new issue