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 <linus.walleij@linaro.org> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
a198420028
commit
c6e927a274
@ -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 New Issue
Block a user