[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdYbOAnZb2H1jmD_QCgT7bkFYtpJ8cEGDFDDkJDG6aMhbQ@mail.gmail.com>
Date: Sat, 20 Jun 2020 22:47:14 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org list" <linuxppc-dev@...ts.ozlabs.org>,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>
Subject: Re: [PATCH v2] tty: serial: cpm_uart: Fix behaviour for non existing GPIOs
On Fri, Jun 12, 2020 at 8:26 PM Christophe Leroy
<christophe.leroy@...roup.eu> wrote:
> devm_gpiod_get_index() doesn't return NULL but -ENOENT when the
> requested GPIO doesn't exist, leading to the following messages:
>
> [ 2.742468] gpiod_direction_input: invalid GPIO (errorpointer)
> [ 2.748147] can't set direction for gpio #2: -2
> [ 2.753081] gpiod_direction_input: invalid GPIO (errorpointer)
> [ 2.758724] can't set direction for gpio #3: -2
> [ 2.763666] gpiod_direction_output: invalid GPIO (errorpointer)
> [ 2.769394] can't set direction for gpio #4: -2
> [ 2.774341] gpiod_direction_input: invalid GPIO (errorpointer)
> [ 2.779981] can't set direction for gpio #5: -2
> [ 2.784545] ff000a20.serial: ttyCPM1 at MMIO 0xfff00a20 (irq = 39, base_baud = 8250000) is a CPM UART
>
> Use devm_gpiod_get_index_optional() instead.
>
> At the same time, handle the error case and properly exit
> with an error.
>
> Fixes: 97cbaf2c829b ("tty: serial: cpm_uart: Convert to use GPIO descriptors")
> Cc: stable@...r.kernel.org
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
> ---
> v2: Using devm_gpiod_get_index_optional() and exiting if error
Excellent!
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists