serial: mctrl_gpio: Fix passing zero to 'ERR_PTR' warning
diff mbox series

Message ID 20201031030530.1304-1-yuehaibing@huawei.com
State In Next
Commit cbd90e746148339ddbf6b980438b0adad990321e
Headers show
Series
  • serial: mctrl_gpio: Fix passing zero to 'ERR_PTR' warning
Related show

Commit Message

YueHaibing Oct. 31, 2020, 3:05 a.m. UTC
drivers/tty/serial/serial_mctrl_gpio.c:214
 mctrl_gpio_init() warn: passing zero to 'ERR_PTR'

gpiod_to_irq() never return 0, so remove the useless test
and make code more clear.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/tty/serial/serial_mctrl_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Slaby Nov. 2, 2020, 8:20 a.m. UTC | #1
On 31. 10. 20, 4:05, YueHaibing wrote:
> drivers/tty/serial/serial_mctrl_gpio.c:214
>   mctrl_gpio_init() warn: passing zero to 'ERR_PTR'
> 
> gpiod_to_irq() never return 0, so remove the useless test
> and make code more clear.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/serial/serial_mctrl_gpio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
> index fb4781292d40..c41d8911ce95 100644
> --- a/drivers/tty/serial/serial_mctrl_gpio.c
> +++ b/drivers/tty/serial/serial_mctrl_gpio.c
> @@ -207,7 +207,7 @@ struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx)
>   			continue;
>   
>   		ret = gpiod_to_irq(gpios->gpio[i]);
> -		if (ret <= 0) {
> +		if (ret < 0) {
>   			dev_err(port->dev,
>   				"failed to find corresponding irq for %s (idx=%d, err=%d)\n",
>   				mctrl_gpios_desc[i].name, idx, ret);
>

Patch
diff mbox series

diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index fb4781292d40..c41d8911ce95 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -207,7 +207,7 @@  struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx)
 			continue;
 
 		ret = gpiod_to_irq(gpios->gpio[i]);
-		if (ret <= 0) {
+		if (ret < 0) {
 			dev_err(port->dev,
 				"failed to find corresponding irq for %s (idx=%d, err=%d)\n",
 				mctrl_gpios_desc[i].name, idx, ret);