Re: [PATCH] serial: mctrl-gpio: drop usages of IS_ERR_OR_NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





W dniu 2015-05-18 o 21:59, Uwe Kleine-König pisze:
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@xxxxxxxxxxxxxx>
---
Hello,

I found this patch in my patch stack. It's probably another fallout of
the chaos I produced while sending the last round of patches touching
serial_mctrl.

Compile tested on ARCH=arm at91_dt_defconfig.

Best regards
Uwe

  drivers/tty/serial/serial_mctrl_gpio.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index 0ec756c62bcf..9f62736b2337 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -49,8 +49,7 @@ void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
  	unsigned int count = 0;
for (i = 0; i < UART_GPIO_MAX; i++)
-		if (!IS_ERR_OR_NULL(gpios->gpio[i]) &&
-		    mctrl_gpios_desc[i].dir_out) {
+		if (gpios->gpio[i] && mctrl_gpios_desc[i].dir_out) {
  			desc_array[count] = gpios->gpio[i];
  			value_array[count] = !!(mctrl & mctrl_gpios_desc[i].mctrl);
  			count++;
@@ -118,7 +117,7 @@ void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
  	enum mctrl_gpio_idx i;
for (i = 0; i < UART_GPIO_MAX; i++)
-		if (!IS_ERR_OR_NULL(gpios->gpio[i]))
+		if (!gpios->gpio[i])

Isn't inverted here?

best regards
Janusz

  			devm_gpiod_put(dev, gpios->gpio[i]);
  	devm_kfree(dev, gpios);
  }

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux