On 23.06.22 at 18:32, Andy Shevchenko wrote: >> >> Ok I see the point. So what about changing it to: > > You mean adding below after the existing code in the module? Right, to be more precise between getting the gpio and the error check: port->rs485_term_gpio = devm_gpiod_get_optional(dev, "rs485-term", GPIOD_OUT_LOW); if (port->rs485_term_gpio && !(port->rs485_supported->flags & SER_RS485_TERMINATE_BUS)) { dev_warn(port->dev, "%s (%d): RS485 termination gpio not supported by driver\n", port->name, port->line); devm_gpiod_put(dev, port->rs485_term_gpio); port->rs485_term_gpio = NULL; } if (IS_ERR(port->rs485_term_gpio)) { ret = PTR_ERR(port->rs485_term_gpio); port->rs485_term_gpio = NULL; return dev_err_probe(dev, ret, "Cannot get rs485-term-gpios\n"); } Regards, Lino > >> if (port->rs485_term_gpio && >> !(port->rs485_supported->flags & SER_RS485_TERMINATE_BUS)) { >> dev_warn(port->dev, >> "%s (%d): RS485 termination gpio not supported by driver\n", >> port->name, port->line); >> devm_gpiod_put(dev, port->rs485_term_gpio); >> port->rs485_term_gpio = NULL; >> } >> >> This would also be consistent to the warnings we print in uart_sanitize_serial_rs485() for invalid >> RS485 settings. > > Probably it's okay, but I dunno we have much on this to gain. Users may start > complaining of this (harmless) warning. I leave it to others to comment. >