[rafael-pm:bleeding-edge 71/77] drivers/thermal/thermal_of.c:536:8: error: passing 'struct thermal_zone_device_ops' to parameter of incompatible type 'const void *'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   2bc44535ed4f6a6013ec53b505c4c381e166f0ce
commit: fe0ea8a4d293acaf02031aaaaeb3dcf7f262e5b3 [71/77] thermal: core: Store zone ops in struct thermal_zone_device
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240210/202402101037.cQIOnsH8-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240210/202402101037.cQIOnsH8-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402101037.cQIOnsH8-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/thermal/thermal_of.c:536:8: error: passing 'struct thermal_zone_device_ops' to parameter of incompatible type 'const void *'
           kfree(of_ops);
                 ^~~~~~
   include/linux/slab.h:227:24: note: passing argument to parameter 'objp' here
   void kfree(const void *objp);
                          ^
   1 error generated.


vim +536 drivers/thermal/thermal_of.c

3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  449  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  450  /**
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  451   * thermal_of_zone_register - Register a thermal zone with device node
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  452   * sensor
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  453   *
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  454   * The thermal_of_zone_register() parses a device tree given a device
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  455   * node sensor and identifier. It searches for the thermal zone
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  456   * associated to the couple sensor/id and retrieves all the thermal
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  457   * zone properties and registers new thermal zone with those
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  458   * properties.
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  459   *
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  460   * @sensor: A device node pointer corresponding to the sensor in the device tree
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  461   * @id: An integer as sensor identifier
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  462   * @data: A private data to be stored in the thermal zone dedicated private area
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  463   * @ops: A set of thermal sensor ops
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  464   *
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  465   * Return: a valid thermal zone structure pointer on success.
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  466   * 	- EINVAL: if the device tree thermal description is malformed
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  467   *	- ENOMEM: if one structure can not be allocated
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  468   *	- Other negative errors are returned by the underlying called functions
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  469   */
ac614a9b4c35bf Daniel Lezcano    2023-04-04  470  static struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor, int id, void *data,
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  471  							    const struct thermal_zone_device_ops *ops)
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  472  {
fe0ea8a4d293ac Rafael J. Wysocki 2024-02-09  473  	struct thermal_zone_device_ops of_ops = *ops;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  474  	struct thermal_zone_device *tz;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  475  	struct thermal_trip *trips;
ac4436a5b20e0e Ahmad Fatoum      2023-07-08  476  	struct thermal_zone_params tzp = {};
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  477  	struct device_node *np;
62e79e38b257a5 Fabio Estevam     2023-11-29  478  	const char *action;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  479  	int delay, pdelay;
990efe2b4813ff Rafael J. Wysocki 2024-02-08  480  	int ntrips;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  481  	int ret;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  482  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  483  	np = of_thermal_zone_find(sensor, id);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  484  	if (IS_ERR(np)) {
9d6792df07367a Daniel Lezcano    2022-08-09  485  		if (PTR_ERR(np) != -ENODEV)
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  486  			pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
7ef2f023c2c77a Ido Schimmel      2022-10-20  487  		ret = PTR_ERR(np);
7ef2f023c2c77a Ido Schimmel      2022-10-20  488  		goto out_kfree_of_ops;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  489  	}
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  490  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  491  	trips = thermal_of_trips_init(np, &ntrips);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  492  	if (IS_ERR(trips)) {
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  493  		pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id);
7ef2f023c2c77a Ido Schimmel      2022-10-20  494  		ret = PTR_ERR(trips);
7ef2f023c2c77a Ido Schimmel      2022-10-20  495  		goto out_kfree_of_ops;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  496  	}
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  497  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  498  	ret = thermal_of_monitor_init(np, &delay, &pdelay);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  499  	if (ret) {
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  500  		pr_err("Failed to initialize monitoring delays from %pOFn\n", np);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  501  		goto out_kfree_trips;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  502  	}
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  503  
ac4436a5b20e0e Ahmad Fatoum      2023-07-08  504  	thermal_of_parameters_init(np, &tzp);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  505  
fe0ea8a4d293ac Rafael J. Wysocki 2024-02-09  506  	of_ops.bind = thermal_of_bind;
fe0ea8a4d293ac Rafael J. Wysocki 2024-02-09  507  	of_ops.unbind = thermal_of_unbind;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  508  
62e79e38b257a5 Fabio Estevam     2023-11-29  509  	ret = of_property_read_string(np, "critical-action", &action);
62e79e38b257a5 Fabio Estevam     2023-11-29  510  	if (!ret)
fe0ea8a4d293ac Rafael J. Wysocki 2024-02-09  511  		if (!of_ops.critical && !strcasecmp(action, "reboot"))
fe0ea8a4d293ac Rafael J. Wysocki 2024-02-09  512  			of_ops.critical = thermal_zone_device_critical_reboot;
62e79e38b257a5 Fabio Estevam     2023-11-29  513  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  514  	tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips,
fe0ea8a4d293ac Rafael J. Wysocki 2024-02-09  515  						     data, &of_ops, &tzp,
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  516  						     pdelay, delay);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  517  	if (IS_ERR(tz)) {
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  518  		ret = PTR_ERR(tz);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  519  		pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret);
ac4436a5b20e0e Ahmad Fatoum      2023-07-08  520  		goto out_kfree_trips;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  521  	}
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  522  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  523  	ret = thermal_zone_device_enable(tz);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  524  	if (ret) {
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  525  		pr_err("Failed to enabled thermal zone '%s', id=%d: %d\n",
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  526  		       tz->type, tz->id, ret);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  527  		thermal_of_zone_unregister(tz);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  528  		return ERR_PTR(ret);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  529  	}
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  530  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  531  	return tz;
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  532  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  533  out_kfree_trips:
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  534  	kfree(trips);
7ef2f023c2c77a Ido Schimmel      2022-10-20  535  out_kfree_of_ops:
7ef2f023c2c77a Ido Schimmel      2022-10-20 @536  	kfree(of_ops);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  537  
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  538  	return ERR_PTR(ret);
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  539  }
3fd6d6e2b4e80f Daniel Lezcano    2022-08-05  540  

:::::: The code at line 536 was first introduced by commit
:::::: 7ef2f023c2c77a452ba5d0c9b1ad04a5a895d553 thermal/of: Fix memory leak on thermal_of_zone_register() failure

:::::: TO: Ido Schimmel <idosch@xxxxxxxxxx>
:::::: CC: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>

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




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux