Am Montag, 18. Mai 2020, 06:50:06 CEST schrieb Lukas Wunner:
> On Sun, May 17, 2020 at 11:56:08PM +0200, Heiko Stuebner wrote:
> > @@ -1457,6 +1458,7 @@ void serial8250_em485_stop_tx(struct uart_8250_port 
> > *p)
> >      * Enable previously disabled RX interrupts.
> >      */
> >     if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
> > +           gpiod_set_value(port->rs485_re_gpio, 1);
> >             serial8250_clear_and_reinit_fifos(p);
> >  
> >             p->ier |= UART_IER_RLSI | UART_IER_RDI;
> 
> The added line needs to be conditional on if (port->rs485_re_gpio)
> because the gpiod could be NULL and gpiod_set_value() doesn't check
> for that.

Need to look deeper at the other comment below, but gpiod_set_value does
check for NULL ;-)

void gpiod_set_value(struct gpio_desc *desc, int value)
{
        VALIDATE_DESC_VOID(desc);
[...]

which expands to

#define VALIDATE_DESC_VOID(desc) do { \
        int __valid = validate_desc(desc, __func__); \
        if (__valid <= 0) \
                return; \
        } while (0)

which does

 */
static int validate_desc(const struct gpio_desc *desc, const char *func)
{
        if (!desc)
                return 0;
[...]


Heiko


Reply via email to