drivers/thermal/thermal_of.c:487:24: warning: returning 'long int' from a function with return type 'struct thermal_zone_device *' makes pointer from integer without a cast

[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:   1cc7a914a31bd41feb404b644539a007f99b4f00
commit: af0c508eaaf052006a183dab9c3a2994615942d1 thermal: core: Store zone ops in struct thermal_zone_device
date:   13 hours ago
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240211/202402111258.zSHkL26j-lkp@xxxxxxxxx/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240211/202402111258.zSHkL26j-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/202402111258.zSHkL26j-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/thermal/thermal_of.c: In function 'thermal_of_zone_register':
>> drivers/thermal/thermal_of.c:487:24: warning: returning 'long int' from a function with return type 'struct thermal_zone_device *' makes pointer from integer without a cast [-Wint-conversion]
     487 |                 return PTR_ERR(np);
         |                        ^~~~~~~~~~~
   drivers/thermal/thermal_of.c:493:24: warning: returning 'long int' from a function with return type 'struct thermal_zone_device *' makes pointer from integer without a cast [-Wint-conversion]
     493 |                 return PTR_ERR(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 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 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




[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