gpio: rockchip: fix get gpio mux operation error return

Change-Id: Ia225ae3acea2d2d2347870b3d6a20c4a7d22e7e9
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
Jianqun Xu 2020-11-12 19:54:38 +08:00 committed by Jianhong Chen
parent 8273b391c5
commit e9c98b3baf
1 changed files with 4 additions and 2 deletions

View File

@ -109,11 +109,13 @@ static int rockchip_gpio_get_function(struct udevice *dev, unsigned offset)
int ret;
ret = pinctrl_get_gpio_mux(priv->pinctrl, priv->bank, offset);
if (ret)
if (ret < 0) {
dev_err(dev, "fail to get gpio mux %d\n", ret);
return ret;
}
/* If it's not 0, then it is not a GPIO */
if (ret)
if (ret > 0)
return GPIOF_FUNC;
is_output = READ_REG(&regs->swport_ddr) & OFFSET_TO_BIT(offset);