Re: [PATCH v3 3/3] serial: core: Move console character device handling from printk

From: Dan Carpenter
Date: Thu Nov 23 2023 - 02:29:33 EST


On Thu, Nov 23, 2023 at 10:24:24AM +0300, Dan Carpenter wrote:
> Hi Tony,
>
> 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/Tony-Lindgren/printk-Save-console-options-for-add_preferred_console_match/20231121-193809
> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> patch link: https://lore.kernel.org/r/20231121113203.61341-4-tony%40atomide.com
> patch subject: [PATCH v3 3/3] serial: core: Move console character device handling from printk
> config: parisc-randconfig-r081-20231122 (https://download.01.org/0day-ci/archive/20231122/202311221437.5Gil0Pml-lkp@xxxxxxxxx/config)
> compiler: hppa-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20231122/202311221437.5Gil0Pml-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/202311221437.5Gil0Pml-lkp@xxxxxxxxx/
>
> smatch warnings:
> drivers/tty/serial/serial_base_bus.c:266 serial_base_add_preferred_console() error: uninitialized symbol 'nmbr_match'.
> drivers/tty/serial/serial_base_bus.c:265 serial_base_add_preferred_console() error: uninitialized symbol 'char_match'.
>
> vim +/nmbr_match +266 drivers/tty/serial/serial_base_bus.c
>
> e4ebdcd790e0f3 Tony Lindgren 2023-11-21 261 int serial_base_add_preferred_console(struct uart_driver *drv,
> e4ebdcd790e0f3 Tony Lindgren 2023-11-21 262 struct uart_port *port)
> e4ebdcd790e0f3 Tony Lindgren 2023-11-21 263 {
> e4ebdcd790e0f3 Tony Lindgren 2023-11-21 264 const char *port_match __free(kfree);
> b1b8726ec3f40b Tony Lindgren 2023-11-21 @265 const char *char_match __free(kfree);
> b1b8726ec3f40b Tony Lindgren 2023-11-21 @266 const char *nmbr_match __free(kfree);
>
> These need to be initialized to NULL.
>
> const char *char_match __free(kfree) = NULL;
>

Let's add a todo to make checkpatch warn about this.

KTODO: make checkpatch warn about __free() functions without an initializer

regards,
dan carpenter