Re: [PATCH v1 1/1] media: ipu3-cio2: Don't dereference fwnode handle
From: kernel test robot
Date: Sat Jul 30 2022 - 17:30:54 EST
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on media-tree/master]
[also build test ERROR on linus/master v5.19-rc8 next-20220728]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/media-ipu3-cio2-Don-t-dereference-fwnode-handle/20220730-235023
base: git://linuxtv.org/media_tree.git master
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220731/202207310535.kgjPgg86-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/a78ba0da9d77a8fa412604492f931b188e1114d5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/media-ipu3-cio2-Don-t-dereference-fwnode-handle/20220730-235023
git checkout a78ba0da9d77a8fa412604492f931b188e1114d5
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
drivers/media/pci/intel/ipu3/cio2-bridge.c: In function 'cio2_bridge_connect_sensor':
>> drivers/media/pci/intel/ipu3/cio2-bridge.c:266:16: error: function declaration isn't a prototype [-Werror=strict-prototypes]
266 | struct fwnode_handle *fwnode, *current;
| ^~~~~~~~~~~~~
In file included from include/linux/mutex.h:14,
from include/linux/kernfs.h:11,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from drivers/media/pci/intel/ipu3/cio2-bridge.c:4:
>> arch/x86/include/asm/current.h:18:17: error: conflicting types for 'get_current'; have 'struct fwnode_handle *()'
18 | #define current get_current()
| ^~~~~~~~~~~
drivers/media/pci/intel/ipu3/cio2-bridge.c:266:40: note: in expansion of macro 'current'
266 | struct fwnode_handle *fwnode, *current;
| ^~~~~~~
arch/x86/include/asm/current.h:13:44: note: previous definition of 'get_current' with type 'struct task_struct *(void)'
13 | static __always_inline struct task_struct *get_current(void)
| ^~~~~~~~~~~
>> drivers/media/pci/intel/ipu3/cio2-bridge.c:326:25: error: lvalue required as left operand of assignment
326 | current = acpi_fwnode_handle(adev);
| ^
cc1: some warnings being treated as errors
vim +266 drivers/media/pci/intel/ipu3/cio2-bridge.c
261
262 static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg,
263 struct cio2_bridge *bridge,
264 struct pci_dev *cio2)
265 {
> 266 struct fwnode_handle *fwnode, *current;
267 struct cio2_sensor *sensor;
268 struct acpi_device *adev;
269 acpi_status status;
270 int ret;
271
272 for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
273 if (!adev->status.enabled)
274 continue;
275
276 if (bridge->n_sensors >= CIO2_NUM_PORTS) {
277 acpi_dev_put(adev);
278 dev_err(&cio2->dev, "Exceeded available CIO2 ports\n");
279 return -EINVAL;
280 }
281
282 sensor = &bridge->sensors[bridge->n_sensors];
283 strscpy(sensor->name, cfg->hid, sizeof(sensor->name));
284
285 ret = cio2_bridge_read_acpi_buffer(adev, "SSDB",
286 &sensor->ssdb,
287 sizeof(sensor->ssdb));
288 if (ret)
289 goto err_put_adev;
290
291 if (sensor->ssdb.vcmtype > ARRAY_SIZE(cio2_vcm_types)) {
292 dev_warn(&adev->dev, "Unknown VCM type %d\n",
293 sensor->ssdb.vcmtype);
294 sensor->ssdb.vcmtype = 0;
295 }
296
297 status = acpi_get_physical_device_location(adev->handle, &sensor->pld);
298 if (ACPI_FAILURE(status)) {
299 ret = -ENODEV;
300 goto err_put_adev;
301 }
302
303 if (sensor->ssdb.lanes > CIO2_MAX_LANES) {
304 dev_err(&adev->dev,
305 "Number of lanes in SSDB is invalid\n");
306 ret = -EINVAL;
307 goto err_free_pld;
308 }
309
310 cio2_bridge_create_fwnode_properties(sensor, bridge, cfg);
311 cio2_bridge_create_connection_swnodes(bridge, sensor);
312
313 ret = software_node_register_nodes(sensor->swnodes);
314 if (ret)
315 goto err_free_pld;
316
317 fwnode = software_node_fwnode(&sensor->swnodes[
318 SWNODE_SENSOR_HID]);
319 if (!fwnode) {
320 ret = -ENODEV;
321 goto err_free_swnodes;
322 }
323
324 sensor->adev = acpi_dev_get(adev);
325
> 326 current = acpi_fwnode_handle(adev);
327 current->secondary = fwnode;
328
329 cio2_bridge_instantiate_vcm_i2c_client(sensor);
330
331 dev_info(&cio2->dev, "Found supported sensor %s\n",
332 acpi_dev_name(adev));
333
334 bridge->n_sensors++;
335 }
336
337 return 0;
338
339 err_free_swnodes:
340 software_node_unregister_nodes(sensor->swnodes);
341 err_free_pld:
342 ACPI_FREE(sensor->pld);
343 err_put_adev:
344 acpi_dev_put(adev);
345 return ret;
346 }
347
--
0-DAY CI Kernel Test Service
https://01.org/lkp