mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
pinctrl: qcom: remove gpiochip in failure cases
This patch releases gpiochip related resources by calling gpiochip_remove when either of gpiochip_add_pin_range and gpiochip_irqchip_add fails. CC: Linus Walleij <[email protected]> CC: "Ivan T. Ivanov" <[email protected]> Acked-by: Bjorn Andersson <[email protected]> Signed-off-by: Pramod Gurav <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
a198420028
commit
c6e927a274
1 changed files with 2 additions and 0 deletions
|
|
@ -829,6 +829,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
|
|||
ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
|
||||
if (ret) {
|
||||
dev_err(pctrl->dev, "Failed to add pin range\n");
|
||||
gpiochip_remove(&pctrl->chip);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -839,6 +840,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
|
|||
IRQ_TYPE_NONE);
|
||||
if (ret) {
|
||||
dev_err(pctrl->dev, "Failed to add irqchip to gpiochip\n");
|
||||
gpiochip_remove(&pctrl->chip);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue