mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	"Kent Gibson" <warthog618@gmail.com>,
	"Jan Lübbe" <jlu@pengutronix.de>, "Marek Vasut" <marex@denx.de>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Linus Walleij" <linus.walleij@linaro.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/9] gpio: sysfs: export the GPIO directory locally in the gpiochip<id> directory
Date: Tue, 24 Jun 2025 06:07:19 +0800	[thread overview]
Message-ID: <202506240548.l2wS2XW6-lkp@intel.com> (raw)
In-Reply-To: <20250623-gpio-sysfs-chip-export-v2-7-d592793f8964@linaro.org>

Hi Bartosz,

kernel test robot noticed the following build errors:

[auto build test ERROR on cb908f3699fb137e28017a8fdf506c35762b3eb6]

url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/gpio-sysfs-add-a-parallel-class-device-for-each-GPIO-chip-using-device-IDs/20250623-170412
base:   cb908f3699fb137e28017a8fdf506c35762b3eb6
patch link:    https://lore.kernel.org/r/20250623-gpio-sysfs-chip-export-v2-7-d592793f8964%40linaro.org
patch subject: [PATCH v2 7/9] gpio: sysfs: export the GPIO directory locally in the gpiochip<id> directory
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250624/202506240548.l2wS2XW6-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250624/202506240548.l2wS2XW6-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/202506240548.l2wS2XW6-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpio/gpiolib-sysfs.c:802:3: error: cannot jump from this goto statement to its label
     802 |                 goto err_free_name;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   drivers/gpio/gpiolib-sysfs.c:795:3: error: cannot jump from this goto statement to its label
     795 |                 goto err_put_dirent;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   drivers/gpio/gpiolib-sysfs.c:786:3: error: cannot jump from this goto statement to its label
     786 |                 goto err_put_dirent;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   drivers/gpio/gpiolib-sysfs.c:780:3: error: cannot jump from this goto statement to its label
     780 |                 goto err_unregister_device;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   drivers/gpio/gpiolib-sysfs.c:773:3: error: cannot jump from this goto statement to its label
     773 |                 goto err_free_data;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   drivers/gpio/gpiolib-sysfs.c:733:3: error: cannot jump from this goto statement to its label
     733 |                 goto err_clear_bit;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   drivers/gpio/gpiolib-sysfs.c:727:3: error: cannot jump from this goto statement to its label
     727 |                 goto err_clear_bit;
         |                 ^
   drivers/gpio/gpiolib-sysfs.c:804:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
     804 |         char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
         |               ^
   7 errors generated.


vim +802 drivers/gpio/gpiolib-sysfs.c

   677	
   678	/**
   679	 * gpiod_export - export a GPIO through sysfs
   680	 * @desc: GPIO to make available, already requested
   681	 * @direction_may_change: true if userspace may change GPIO direction
   682	 * Context: arch_initcall or later
   683	 *
   684	 * When drivers want to make a GPIO accessible to userspace after they
   685	 * have requested it -- perhaps while debugging, or as part of their
   686	 * public interface -- they may use this routine.  If the GPIO can
   687	 * change direction (some can't) and the caller allows it, userspace
   688	 * will see "direction" sysfs attribute which may be used to change
   689	 * the gpio's direction.  A "value" attribute will always be provided.
   690	 *
   691	 * Returns:
   692	 * 0 on success, or negative errno on failure.
   693	 */
   694	int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
   695	{
   696		struct gpiodev_data *gdev_data;
   697		struct gpiod_data *desc_data;
   698		struct gpio_device *gdev;
   699		struct attribute **attrs;
   700		int status;
   701	
   702		/* can't export until sysfs is available ... */
   703		if (!class_is_registered(&gpio_class)) {
   704			pr_debug("%s: called too early!\n", __func__);
   705			return -ENOENT;
   706		}
   707	
   708		if (!desc) {
   709			pr_debug("%s: invalid gpio descriptor\n", __func__);
   710			return -EINVAL;
   711		}
   712	
   713		CLASS(gpio_chip_guard, guard)(desc);
   714		if (!guard.gc)
   715			return -ENODEV;
   716	
   717		if (test_and_set_bit(FLAG_EXPORT, &desc->flags))
   718			return -EPERM;
   719	
   720		gdev = desc->gdev;
   721	
   722		guard(mutex)(&sysfs_lock);
   723	
   724		if (!test_bit(FLAG_REQUESTED, &desc->flags)) {
   725			gpiod_dbg(desc, "%s: unavailable (not requested)\n", __func__);
   726			status = -EPERM;
   727			goto err_clear_bit;
   728		}
   729	
   730		desc_data = kzalloc(sizeof(*desc_data), GFP_KERNEL);
   731		if (!desc_data) {
   732			status = -ENOMEM;
   733			goto err_clear_bit;
   734		}
   735	
   736		desc_data->desc = desc;
   737		mutex_init(&desc_data->mutex);
   738		if (guard.gc->direction_input && guard.gc->direction_output)
   739			desc_data->direction_can_change = direction_may_change;
   740		else
   741			desc_data->direction_can_change = false;
   742	
   743		gpiod_attr_init(&desc_data->dir_attr, "direction",
   744				direction_show, direction_store);
   745		gpiod_attr_init(&desc_data->val_attr, "value", value_show, value_store);
   746		gpiod_attr_init(&desc_data->edge_attr, "edge", edge_show, edge_store);
   747		gpiod_attr_init(&desc_data->active_low_attr, "active_low",
   748					active_low_show, active_low_store);
   749	
   750		attrs = desc_data->attrs;
   751		desc_data->attr_group.is_visible = gpio_is_visible;
   752		attrs[GPIO_SYSFS_LINE_ATTR_DIRECTION] = &desc_data->dir_attr.attr;
   753		attrs[GPIO_SYSFS_LINE_ATTR_VALUE] = &desc_data->val_attr.attr;
   754		attrs[GPIO_SYSFS_LINE_ATTR_EDGE] = &desc_data->edge_attr.attr;
   755		attrs[GPIO_SYSFS_LINE_ATTR_ACTIVE_LOW] =
   756					&desc_data->active_low_attr.attr;
   757	
   758		desc_data->attr_group.attrs = desc_data->attrs;
   759		desc_data->attr_groups[0] = &desc_data->attr_group;
   760	
   761		/*
   762		 * Note: we need to continue passing desc_data here as there's still
   763		 * at least one known user of gpiod_export_link() in the tree. This
   764		 * function still uses class_find_device() internally.
   765		 */
   766		desc_data->dev = device_create_with_groups(&gpio_class, &gdev->dev,
   767							   MKDEV(0, 0), desc_data,
   768							   desc_data->attr_groups,
   769							   "gpio%u",
   770							   desc_to_gpio(desc));
   771		if (IS_ERR(desc_data->dev)) {
   772			status = PTR_ERR(desc_data->dev);
   773			goto err_free_data;
   774		}
   775	
   776		desc_data->value_class_node = sysfs_get_dirent(desc_data->dev->kobj.sd,
   777							       "value");
   778		if (!desc_data->value_class_node) {
   779			status = -ENODEV;
   780			goto err_unregister_device;
   781		}
   782	
   783		gdev_data = gdev_get_data(gdev);
   784		if (!gdev_data) {
   785			status = -ENODEV;
   786			goto err_put_dirent;
   787		}
   788	
   789		list_add(&desc_data->list, &gdev_data->exported_lines);
   790	
   791		desc_data->attr_group.name = kasprintf(GFP_KERNEL, "gpio%u",
   792						       gpio_chip_hwgpio(desc));
   793		if (!desc_data->attr_group.name) {
   794			status = -ENOMEM;
   795			goto err_put_dirent;
   796		}
   797	
   798		desc_data->parent = &gdev_data->cdev_id->kobj;
   799		status = sysfs_create_groups(desc_data->parent,
   800					     desc_data->attr_groups);
   801		if (status)
 > 802			goto err_free_name;
   803	
   804		char *path __free(kfree) = kasprintf(GFP_KERNEL, "gpio%u/value",
   805						     gpio_chip_hwgpio(desc));
   806		if (!path) {
   807			status = -ENOMEM;
   808			goto err_remove_groups;
   809		}
   810	
   811		desc_data->value_chip_node = kernfs_walk_and_get(desc_data->parent->sd,
   812								 path);
   813		if (!desc_data->value_chip_node) {
   814			status = -ENODEV;
   815			goto err_remove_groups;
   816		}
   817	
   818		return 0;
   819	
   820	err_remove_groups:
   821		sysfs_remove_groups(desc_data->parent, desc_data->attr_groups);
   822	err_free_name:
   823		kfree(desc_data->attr_group.name);
   824	err_put_dirent:
   825		sysfs_put(desc_data->value_class_node);
   826	err_unregister_device:
   827		device_unregister(desc_data->dev);
   828	err_free_data:
   829		kfree(desc_data);
   830	err_clear_bit:
   831		clear_bit(FLAG_EXPORT, &desc->flags);
   832		gpiod_dbg(desc, "%s: status %d\n", __func__, status);
   833		return status;
   834	}
   835	EXPORT_SYMBOL_GPL(gpiod_export);
   836	

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

  reply	other threads:[~2025-06-23 22:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23  8:59 [PATCH v2 0/9] gpio: sysfs: add a per-chip export/unexport attribute pair Bartosz Golaszewski
2025-06-23  8:59 ` [PATCH v2 1/9] gpio: sysfs: add a parallel class device for each GPIO chip using device IDs Bartosz Golaszewski
2025-06-27 15:21   ` Andy Shevchenko
2025-06-30  8:34     ` Bartosz Golaszewski
2025-06-30  9:16       ` Andy Shevchenko
2025-06-23  8:59 ` [PATCH v2 2/9] gpio: sysfs: only get the dirent reference for the value attr once Bartosz Golaszewski
2025-06-27 15:35   ` Andy Shevchenko
2025-06-30  8:41     ` Bartosz Golaszewski
2025-06-23  8:59 ` [PATCH v2 3/9] gpio: sysfs: pass gpiod_data directly to internal GPIO sysfs functions Bartosz Golaszewski
2025-06-24 19:32   ` Linus Walleij
2025-06-27 15:37   ` Andy Shevchenko
2025-06-23  8:59 ` [PATCH v2 4/9] gpio: sysfs: don't use driver data in sysfs callbacks for line attributes Bartosz Golaszewski
2025-06-24 19:33   ` Linus Walleij
2025-06-27 15:41   ` Andy Shevchenko
2025-06-30  8:57     ` Bartosz Golaszewski
2025-06-30 10:05       ` Andy Shevchenko
2025-06-23  8:59 ` [PATCH v2 5/9] gpio: sysfs: rename the data variable in gpiod_(un)export() Bartosz Golaszewski
2025-06-24 19:34   ` Linus Walleij
2025-06-27 15:43   ` Andy Shevchenko
2025-06-30  8:57     ` Bartosz Golaszewski
2025-06-30  9:03       ` Bartosz Golaszewski
2025-06-23  8:59 ` [PATCH v2 6/9] gpio: sysfs: don't look up exported lines as class devices Bartosz Golaszewski
2025-06-24 19:34   ` Linus Walleij
2025-06-27 15:47   ` Andy Shevchenko
2025-06-23  8:59 ` [PATCH v2 7/9] gpio: sysfs: export the GPIO directory locally in the gpiochip<id> directory Bartosz Golaszewski
2025-06-23 22:07   ` kernel test robot [this message]
2025-06-23  8:59 ` [PATCH v2 8/9] gpio: sysfs: allow disabling the legacy parts of the GPIO sysfs interface Bartosz Golaszewski
2025-06-24 11:31   ` Geert Uytterhoeven
2025-06-24 19:40   ` Linus Walleij
2025-06-27 11:40   ` kernel test robot
2025-06-23  8:59 ` [PATCH v2 9/9] gpio: TODO: remove the task for the sysfs rework Bartosz Golaszewski

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=202506240548.l2wS2XW6-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=brgl@bgdev.pl \
    --cc=geert+renesas@glider.be \
    --cc=jlu@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=marex@denx.de \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=warthog618@gmail.com \
    /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

all inboxes | Powered by JetHome®