Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [jirislaby:devel 105/111] drivers/tty/serial/serial_core.c:3105:3: error: cannot jump from this goto statement to its label
Date: Mon, 17 Mar 2025 18:45:57 +0800	[thread overview]
Message-ID: <202503171815.hLKSZvJJ-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git devel
head:   a51ffe221e2da2df430888699365394c646aed12
commit: 3d93b0ef6e12a7eea9ca53e38b755617089374b4 [105/111] serial: drv->state -> xarray
config: x86_64-buildonly-randconfig-002-20250317 (https://download.01.org/0day-ci/archive/20250317/202503171815.hLKSZvJJ-lkp@intel.com/config)
compiler: clang version 20.1.0 (https://github.com/llvm/llvm-project 24a30daaa559829ad079f2ff7f73eb4e18095f88)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250317/202503171815.hLKSZvJJ-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503171815.hLKSZvJJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/tty/serial/serial_core.c:30:
   In file included from include/linux/security.h:33:
   In file included from include/linux/mm.h:2302:
   include/linux/vmstat.h:507:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     507 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/tty/serial/serial_core.c:3105:3: error: cannot jump from this goto statement to its label
    3105 |                 goto err_free_state;
         |                 ^
   drivers/tty/serial/serial_core.c:3111:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
    3111 |         guard(mutex)(&port->mutex);
         |         ^
   include/linux/cleanup.h:309:15: note: expanded from macro 'guard'
     309 |         CLASS(_name, __UNIQUE_ID(guard))
         |                      ^
   include/linux/compiler.h:166:29: note: expanded from macro '__UNIQUE_ID'
     166 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
         |                             ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   <scratch space>:41:1: note: expanded from here
      41 | __UNIQUE_ID_guard589
         | ^
   1 warning and 1 error generated.


vim +3105 drivers/tty/serial/serial_core.c

  3079	
  3080	/**
  3081	 * serial_core_add_one_port - attach a driver-defined port structure
  3082	 * @drv: pointer to the uart low level driver structure for this port
  3083	 * @uport: uart port structure to use for this port.
  3084	 *
  3085	 * Context: task context, might sleep
  3086	 *
  3087	 * This allows the driver @drv to register its own uart_port structure with the
  3088	 * core driver. The main purpose is to allow the low level uart drivers to
  3089	 * expand uart_port, rather than having yet more levels of structures.
  3090	 * Caller must hold port_mutex.
  3091	 */
  3092	static int serial_core_add_one_port(struct uart_driver *drv, struct uart_port *uport)
  3093	{
  3094		struct uart_state *state;
  3095		struct tty_port *port;
  3096		struct device *tty_dev;
  3097		int num_groups, ret;
  3098	
  3099		state = kzalloc(sizeof(*state), GFP_KERNEL);
  3100		if (!state)
  3101			return -ENOMEM;
  3102	
  3103		ret = xa_err(xa_store(&drv->state, uport->line, state, GFP_KERNEL));
  3104		if (ret)
> 3105			goto err_free_state;
  3106	
  3107		port = &state->port;
  3108		tty_port_init(port);
  3109		port->ops = &uart_port_ops;
  3110	
  3111		guard(mutex)(&port->mutex);
  3112		/* Link the port to the driver state table and vice versa */
  3113		atomic_set(&state->refcount, 1);
  3114		init_waitqueue_head(&state->remove_wait);
  3115		state->uart_port = uport;
  3116		uport->state = state;
  3117	
  3118		/*
  3119		 * If this port is in use as a console then the spinlock is already
  3120		 * initialised.
  3121		 */
  3122		if (!uart_console_registered(uport))
  3123			uart_port_spin_lock_init(uport);
  3124	
  3125		state->pm_state = UART_PM_STATE_UNDEFINED;
  3126		uart_port_set_cons(uport, drv->cons);
  3127		uport->minor = drv->tty_driver->minor_start + uport->line;
  3128		uport->name = kasprintf(GFP_KERNEL, "%s%d", drv->dev_name,
  3129					drv->tty_driver->name_base + uport->line);
  3130		if (!uport->name)
  3131			return -ENOMEM;
  3132	
  3133		if (uport->cons && uport->dev)
  3134			of_console_check(uport->dev->of_node, uport->cons->name, uport->line);
  3135	
  3136		uart_configure_port(drv, state, uport);
  3137	
  3138		port->console = uart_console(uport);
  3139	
  3140		num_groups = 2;
  3141		if (uport->attr_group)
  3142			num_groups++;
  3143	
  3144		uport->tty_groups = kcalloc(num_groups, sizeof(*uport->tty_groups),
  3145					    GFP_KERNEL);
  3146		if (!uport->tty_groups)
  3147			return -ENOMEM;
  3148	
  3149		uport->tty_groups[0] = &tty_dev_attr_group;
  3150		if (uport->attr_group)
  3151			uport->tty_groups[1] = uport->attr_group;
  3152	
  3153		/* Ensure serdev drivers can call serdev_device_open() right away */
  3154		uport->flags &= ~UPF_DEAD;
  3155	
  3156		/*
  3157		 * Register the port whether it's detected or not.  This allows
  3158		 * setserial to be used to alter this port's parameters.
  3159		 */
  3160		tty_dev = tty_port_register_device_attr_serdev(port, drv->tty_driver,
  3161				uport->line, uport->dev, &uport->port_dev->dev, port,
  3162				uport->tty_groups);
  3163		if (!IS_ERR(tty_dev)) {
  3164			device_set_wakeup_capable(tty_dev, 1);
  3165		} else {
  3166			uport->flags |= UPF_DEAD;
  3167			dev_err(uport->dev, "Cannot register tty device on line %d\n",
  3168			       uport->line);
  3169		}
  3170	
  3171		return 0;
  3172	err_free_state:
  3173		kfree(state);
  3174		return ret;
  3175	}
  3176	

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

                 reply	other threads:[~2025-03-17 10:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202503171815.hLKSZvJJ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jirislaby@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox