mirror of
https://github.com/torvalds/linux.git
synced 2024-12-22 10:56:40 +00:00
serial: mctrl-gpio: drop usages of IS_ERR_OR_NULL
The function mctrl_gpio_init returns failure if the assignment to any member of the gpio array results in an error pointer. So there is no need to check for such error values in the other functions. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c33eecc7ab
commit
445df7ff3f
@ -49,8 +49,7 @@ void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
|
|||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
|
|
||||||
for (i = 0; i < UART_GPIO_MAX; i++)
|
for (i = 0; i < UART_GPIO_MAX; i++)
|
||||||
if (!IS_ERR_OR_NULL(gpios->gpio[i]) &&
|
if (gpios->gpio[i] && mctrl_gpios_desc[i].dir_out) {
|
||||||
mctrl_gpios_desc[i].dir_out) {
|
|
||||||
desc_array[count] = gpios->gpio[i];
|
desc_array[count] = gpios->gpio[i];
|
||||||
value_array[count] = !!(mctrl & mctrl_gpios_desc[i].mctrl);
|
value_array[count] = !!(mctrl & mctrl_gpios_desc[i].mctrl);
|
||||||
count++;
|
count++;
|
||||||
@ -118,7 +117,7 @@ void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
|
|||||||
enum mctrl_gpio_idx i;
|
enum mctrl_gpio_idx i;
|
||||||
|
|
||||||
for (i = 0; i < UART_GPIO_MAX; i++)
|
for (i = 0; i < UART_GPIO_MAX; i++)
|
||||||
if (!IS_ERR_OR_NULL(gpios->gpio[i]))
|
if (gpios->gpio[i])
|
||||||
devm_gpiod_put(dev, gpios->gpio[i]);
|
devm_gpiod_put(dev, gpios->gpio[i]);
|
||||||
devm_kfree(dev, gpios);
|
devm_kfree(dev, gpios);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user