Commit a7a794ec authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

greybus: arche-apb: Don't use gpio after failing to request it

If devm_gpio_request() returns an error, we shouldn't try to set the
direction of the same gpio.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent db0cff55
......@@ -137,12 +137,15 @@ static int apb_ctrl_init_seq(struct platform_device *pdev,
/* On DB3 clock was not mandatory */
if (gpio_is_valid(apb->clk_en_gpio)) {
ret = devm_gpio_request(dev, apb->clk_en_gpio, "apb_clk_en");
if (ret)
if (ret) {
dev_warn(dev, "Failed requesting APB clock en gpio %d\n",
apb->clk_en_gpio);
ret = gpio_direction_output(apb->clk_en_gpio, 1);
if (ret)
dev_warn(dev, "failed to set APB clock en gpio dir:%d\n", ret);
apb->clk_en_gpio);
} else {
ret = gpio_direction_output(apb->clk_en_gpio, 1);
if (ret)
dev_warn(dev, "failed to set APB clock en gpio dir:%d\n",
ret);
}
}
/* Hold APB in reset state */
ret = devm_gpio_request(dev, apb->resetn_gpio, "apb-reset");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment