Re: [PATCH 2/2] serial: core: implement support for rs485-mux-gpios

From: Dan Carpenter
Date: Tue Nov 21 2023 - 05:49:20 EST


Hi Rasmus,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Rasmus-Villemoes/dt-bindings-serial-rs485-add-rs485-mux-gpios-binding/20231120-231551
base: v6.7-rc2
patch link: https://lore.kernel.org/r/20231120151056.148450-3-linux%40rasmusvillemoes.dk
patch subject: [PATCH 2/2] serial: core: implement support for rs485-mux-gpios
config: hexagon-randconfig-r071-20231121 (https://download.01.org/0day-ci/archive/20231121/202311211751.MgZLovko-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20231121/202311211751.MgZLovko-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202311211751.MgZLovko-lkp@xxxxxxxxx/

New smatch warnings:
drivers/tty/serial/serial_core.c:3651 uart_get_rs485_mode() warn: passing zero to 'PTR_ERR'

Old smatch warnings:
drivers/tty/serial/serial_core.c:2996 iomem_base_show() warn: argument 3 to %lX specifier is cast from pointer

vim +/PTR_ERR +3651 drivers/tty/serial/serial_core.c

d58a2df3d8877b Lukas Wunner 2020-05-18 3629 /*
d58a2df3d8877b Lukas Wunner 2020-05-18 3630 * Disabling termination by default is the safe choice: Else if many
d58a2df3d8877b Lukas Wunner 2020-05-18 3631 * bus participants enable it, no communication is possible at all.
d58a2df3d8877b Lukas Wunner 2020-05-18 3632 * Works fine for short cables and users may enable for longer cables.
d58a2df3d8877b Lukas Wunner 2020-05-18 3633 */
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3634 desc = devm_gpiod_get_optional(dev, "rs485-term", GPIOD_OUT_LOW);
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3635 if (IS_ERR(desc))
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3636 return dev_err_probe(dev, PTR_ERR(desc), "Cannot get rs485-term-gpios\n");
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3637 port->rs485_term_gpio = desc;
8bec874f84d826 Ilpo Järvinen 2022-07-04 3638 if (port->rs485_term_gpio)
8bec874f84d826 Ilpo Järvinen 2022-07-04 3639 port->rs485_supported.flags |= SER_RS485_TERMINATE_BUS;
d58a2df3d8877b Lukas Wunner 2020-05-18 3640
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3641 dflags = (rs485conf->flags & SER_RS485_RX_DURING_TX) ?
163f080eb717d2 Christoph Niedermaier 2022-12-02 3642 GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3643 desc = devm_gpiod_get_optional(dev, "rs485-rx-during-tx", dflags);
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3644 if (IS_ERR(desc))
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3645 return dev_err_probe(dev, PTR_ERR(desc), "Cannot get rs485-rx-during-tx-gpios\n");
7cda0b9eb6eb9e Andy Shevchenko 2023-10-03 3646 port->rs485_rx_during_tx_gpio = desc;
163f080eb717d2 Christoph Niedermaier 2022-12-02 3647
da0ccd117da1e4 Rasmus Villemoes 2023-11-20 3648 dflags = (rs485conf->flags & SER_RS485_ENABLED) ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
da0ccd117da1e4 Rasmus Villemoes 2023-11-20 3649 desc = devm_gpiod_get_optional(dev, "rs485-mux", dflags);
da0ccd117da1e4 Rasmus Villemoes 2023-11-20 3650 if (IS_ERR(desc))
da0ccd117da1e4 Rasmus Villemoes 2023-11-20 @3651 return dev_err_probe(dev, PTR_ERR(port->rs485_mux_gpio),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Should be PTR_ERR(desc).

da0ccd117da1e4 Rasmus Villemoes 2023-11-20 3652 "Cannot get rs485-mux-gpios\n");
da0ccd117da1e4 Rasmus Villemoes 2023-11-20 3653 port->rs485_mux_gpio = desc;
da0ccd117da1e4 Rasmus Villemoes 2023-11-20 3654
c150c0f362c1e5 Lukas Wunner 2020-05-12 3655 return 0;
ef838a81dd4de1 Uwe Kleine-König 2017-09-13 3656 }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki