* [rafael-pm:bleeding-edge 77/80] drivers/thermal/thermal_of.c:487:9-16: WARNING: ERR_CAST can be used with np
@ 2024-02-12 3:04 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-02-12 3:04 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: oe-kbuild-all, linux-acpi, devel, linux-pm, Stanislaw Gruszka
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head: f48788def3dc3b44ce2aed41c78692873b23030d
commit: cced01e7b1ef041514785f311601fa0897eb186e [77/80] thermal: core: Store zone ops in struct thermal_zone_device
config: x86_64-randconfig-101-20240212 (https://download.01.org/0day-ci/archive/20240212/202402121043.uk6ySvwU-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
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/202402121043.uk6ySvwU-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> drivers/thermal/thermal_of.c:487:9-16: WARNING: ERR_CAST can be used with np
>> drivers/thermal/thermal_of.c:493:9-16: WARNING: ERR_CAST can be used with trips
vim +487 drivers/thermal/thermal_of.c
449
450 /**
451 * thermal_of_zone_register - Register a thermal zone with device node
452 * sensor
453 *
454 * The thermal_of_zone_register() parses a device tree given a device
455 * node sensor and identifier. It searches for the thermal zone
456 * associated to the couple sensor/id and retrieves all the thermal
457 * zone properties and registers new thermal zone with those
458 * properties.
459 *
460 * @sensor: A device node pointer corresponding to the sensor in the device tree
461 * @id: An integer as sensor identifier
462 * @data: A private data to be stored in the thermal zone dedicated private area
463 * @ops: A set of thermal sensor ops
464 *
465 * Return: a valid thermal zone structure pointer on success.
466 * - EINVAL: if the device tree thermal description is malformed
467 * - ENOMEM: if one structure can not be allocated
468 * - Other negative errors are returned by the underlying called functions
469 */
470 static struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor, int id, void *data,
471 const struct thermal_zone_device_ops *ops)
472 {
473 struct thermal_zone_device_ops of_ops = *ops;
474 struct thermal_zone_device *tz;
475 struct thermal_trip *trips;
476 struct thermal_zone_params tzp = {};
477 struct device_node *np;
478 const char *action;
479 int delay, pdelay;
480 int ntrips;
481 int ret;
482
483 np = of_thermal_zone_find(sensor, id);
484 if (IS_ERR(np)) {
485 if (PTR_ERR(np) != -ENODEV)
486 pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
> 487 return ERR_PTR(PTR_ERR(np));
488 }
489
490 trips = thermal_of_trips_init(np, &ntrips);
491 if (IS_ERR(trips)) {
492 pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id);
> 493 return ERR_PTR(PTR_ERR(trips));
494 }
495
496 ret = thermal_of_monitor_init(np, &delay, &pdelay);
497 if (ret) {
498 pr_err("Failed to initialize monitoring delays from %pOFn\n", np);
499 goto out_kfree_trips;
500 }
501
502 thermal_of_parameters_init(np, &tzp);
503
504 of_ops.bind = thermal_of_bind;
505 of_ops.unbind = thermal_of_unbind;
506
507 ret = of_property_read_string(np, "critical-action", &action);
508 if (!ret)
509 if (!of_ops.critical && !strcasecmp(action, "reboot"))
510 of_ops.critical = thermal_zone_device_critical_reboot;
511
512 tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips,
513 data, &of_ops, &tzp,
514 pdelay, delay);
515 if (IS_ERR(tz)) {
516 ret = PTR_ERR(tz);
517 pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret);
518 goto out_kfree_trips;
519 }
520
521 ret = thermal_zone_device_enable(tz);
522 if (ret) {
523 pr_err("Failed to enabled thermal zone '%s', id=%d: %d\n",
524 tz->type, tz->id, ret);
525 thermal_of_zone_unregister(tz);
526 return ERR_PTR(ret);
527 }
528
529 return tz;
530
531 out_kfree_trips:
532 kfree(trips);
533
534 return ERR_PTR(ret);
535 }
536
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-12 3:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-12 3:04 [rafael-pm:bleeding-edge 77/80] drivers/thermal/thermal_of.c:487:9-16: WARNING: ERR_CAST can be used with np kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox