[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202512271806.n2lycyZw-lkp@intel.com>
Date: Tue, 30 Dec 2025 19:47:05 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev,
Shivendra Pratap <shivendra.pratap@....qualcomm.com>,
Sebastian Reichel <sre@...nel.org>,
Bartosz Golaszewski <bgolasze@...cinc.com>,
Bjorn Andersson <andersson@...nel.org>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-pm@...r.kernel.org,
Shivendra Pratap <shivendra.pratap@....qualcomm.com>
Subject: Re: [PATCH v22 2/2] power: reset: reboot-mode: Expose sysfs for
registered reboot_modes
Hi Shivendra,
kernel test robot noticed the following build warnings:
url: https://github.com/intel-lab-lkp/linux/commits/Shivendra-Pratap/Documentation-ABI-Add-sysfs-class-reboot-mode-reboot_modes/20251227-025914
base: cc3aa43b44bdb43dfbac0fcb51c56594a11338a8
patch link: https://lore.kernel.org/r/20251227-next-15nov_expose_sysfs-v22-2-2d153438ba19%40oss.qualcomm.com
patch subject: [PATCH v22 2/2] power: reset: reboot-mode: Expose sysfs for registered reboot_modes
config: x86_64-randconfig-161-20251227 (https://download.01.org/0day-ci/archive/20251227/202512271806.n2lycyZw-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
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@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202512271806.n2lycyZw-lkp@intel.com/
smatch warnings:
drivers/power/reset/reboot-mode.c:147 reboot_mode_create_device() error: we previously assumed 'head' could be null (see line 112)
vim +/head +147 drivers/power/reset/reboot-mode.c
e5f49083a20ae0 Shivendra Pratap 2025-12-27 103 static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
e5f49083a20ae0 Shivendra Pratap 2025-12-27 104 {
e5f49083a20ae0 Shivendra Pratap 2025-12-27 105 struct sysfs_data *sysfs_info;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 106 struct sysfs_data *next;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 107 struct list_head *head;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 108 struct mode_info *info;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 109 int ret;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 110
e5f49083a20ae0 Shivendra Pratap 2025-12-27 111 head = kzalloc(sizeof(*head), GFP_KERNEL);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 @112 if (!head) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27 113 ret = -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 114 goto error;
This should just be return -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 115 }
e5f49083a20ae0 Shivendra Pratap 2025-12-27 116
e5f49083a20ae0 Shivendra Pratap 2025-12-27 117 INIT_LIST_HEAD(head);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 118
e5f49083a20ae0 Shivendra Pratap 2025-12-27 119 list_for_each_entry(info, &reboot->head, list) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27 120 sysfs_info = kzalloc(sizeof(*sysfs_info), GFP_KERNEL);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 121 if (!sysfs_info) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27 122 ret = -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 123 goto error;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 124 }
e5f49083a20ae0 Shivendra Pratap 2025-12-27 125
e5f49083a20ae0 Shivendra Pratap 2025-12-27 126 sysfs_info->mode = kstrdup_const(info->mode, GFP_KERNEL);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 127 if (!sysfs_info->mode) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27 128 kfree(sysfs_info);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 129 ret = -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 130 goto error;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 131 }
e5f49083a20ae0 Shivendra Pratap 2025-12-27 132
e5f49083a20ae0 Shivendra Pratap 2025-12-27 133 list_add_tail(&sysfs_info->list, head);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 134 }
e5f49083a20ae0 Shivendra Pratap 2025-12-27 135
e5f49083a20ae0 Shivendra Pratap 2025-12-27 136 reboot->reboot_mode_device = device_create(&reboot_mode_class, NULL, 0,
e5f49083a20ae0 Shivendra Pratap 2025-12-27 137 (void *)head, reboot->dev->driver->name);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 138
e5f49083a20ae0 Shivendra Pratap 2025-12-27 139 if (IS_ERR(reboot->reboot_mode_device)) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27 140 ret = PTR_ERR(reboot->reboot_mode_device);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 141 goto error;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 142 }
e5f49083a20ae0 Shivendra Pratap 2025-12-27 143
e5f49083a20ae0 Shivendra Pratap 2025-12-27 144 return 0;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 145
e5f49083a20ae0 Shivendra Pratap 2025-12-27 146 error:
e5f49083a20ae0 Shivendra Pratap 2025-12-27 @147 list_for_each_entry_safe(sysfs_info, next, head, list) {
^^^^
But it is a crash instead.
e5f49083a20ae0 Shivendra Pratap 2025-12-27 148 list_del(&sysfs_info->list);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 149 kfree_const(sysfs_info->mode);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 150 kfree(sysfs_info);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 151 }
e5f49083a20ae0 Shivendra Pratap 2025-12-27 152
e5f49083a20ae0 Shivendra Pratap 2025-12-27 153 kfree(head);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 154 reboot->reboot_mode_device = NULL;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 155 return ret;
e5f49083a20ae0 Shivendra Pratap 2025-12-27 156 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists