diff options
author | Michal Simek <michal.simek@xilinx.com> | 2018-07-23 12:08:49 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2018-08-07 11:03:42 +0200 |
commit | ddd7b3fa33a01c469c920c249e97131ab8f28ada (patch) | |
tree | 4270491c557ccafe14e885fd27139adc9c049dea /drivers/gpio/xilinx_gpio.c | |
parent | 2570e12960486cdf2b1e0e3fb8f6100116ccf65e (diff) | |
download | u-boot-ddd7b3fa33a01c469c920c249e97131ab8f28ada.tar.gz |
gpio: xilinx: Find out bank before use in xilinx_gpio_get_function()
Call xilinx_gpio_get_bank_pin() before use.
Reported-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Diffstat (limited to 'drivers/gpio/xilinx_gpio.c')
-rw-r--r-- | drivers/gpio/xilinx_gpio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c index 48b52c985a..8ce08d80f4 100644 --- a/drivers/gpio/xilinx_gpio.c +++ b/drivers/gpio/xilinx_gpio.c @@ -435,6 +435,10 @@ static int xilinx_gpio_get_function(struct udevice *dev, unsigned offset) int val, ret; u32 bank, pin; + ret = xilinx_gpio_get_bank_pin(offset, &bank, &pin, dev); + if (ret) + return ret; + /* Check if all pins are inputs */ if (platdata->bank_input[bank]) return GPIOF_INPUT; @@ -443,10 +447,6 @@ static int xilinx_gpio_get_function(struct udevice *dev, unsigned offset) if (platdata->bank_output[bank]) return GPIOF_OUTPUT; - ret = xilinx_gpio_get_bank_pin(offset, &bank, &pin, dev); - if (ret) - return ret; - /* FIXME test on dual */ val = readl(&platdata->regs->gpiodir + bank * 2); val = !(val & (1 << pin)); |