lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Feb 2015 08:59:55 -0800
From:	Guenter Roeck <linux@...ck-us.net>
To:	Lukasz Majewski <l.majewski@...sung.com>
Cc:	Eduardo Valentin <edubezval@...il.com>,
	Kamil Debski <k.debski@...sung.com>,
	Jean Delvare <jdelvare@...e.de>, Kukjin Kim <kgene@...nel.org>,
	lm-sensors@...sensors.org,
	Linux PM list <linux-pm@...r.kernel.org>,
	"linux-samsung-soc@...r.kernel.org" 
	<linux-samsung-soc@...r.kernel.org>, devicetree@...r.kernel.org,
	Lukasz Majewski <l.majewski@...ess.pl>,
	Kukjin Kim <kgene.kim@...sung.com>,
	linux-kernel@...r.kernel.org,
	Sjoerd Simons <sjoerd.simons@...labora.co.uk>,
	Abhilash Kesavan <kesavan.abhilash@...il.com>,
	Abhilash Kesavan <a.kesavan@...sung.com>
Subject: Re: [PATCH v4 7/8] hwmon: pwm-fan: Read PWM FAN configuration from
 device tree

On Mon, Feb 23, 2015 at 05:51:22PM +0100, Lukasz Majewski wrote:
> Hi Guenter,
> 
> > On Mon, Feb 23, 2015 at 05:13:36PM +0100, Lukasz Majewski wrote:
> > > Hi Guenter,
> > > 
> > [ ... ]
> > 
> > > > 
> > > > If devicetree is not configured, of_property_count_elems_of_size
> > > > returns -ENOSYS, which is returned, causing the driver to fail
> > > > loading.
> > > 
> > > Has of_property_count_elems_of_size() returns -ENOSYS?
> > > 
> > > Maybe something has changed, but in my linux-vanila (3.19-rc4)
> > > at ./drivers/of/base.c it returns -EINVAL, -ENODATA or number of
> > > elements.
> > > 
> > > Have I missed something?
> > > 
> > Hi Lukasz,
> > 
> > Yes, you have. Check include/linux/of.h, line 484, in latest mainline.
> 
> Ok. Now I got it.
> 
> The above situation shouldn't happen if I put of_find_property() check
> on the very beginning of this function (it returns NULL when DT support
> is not compiled).
> 

Correct.

> The function would look as follows:
> 
> int 
> pwm_fan_of_get_cooling_data(struct device *dev, struct pwm_fan_ctx
> *ctx) 
> {       
>         struct device_node *np = dev->of_node;
> 	int num, i, ret;
> 
> 	if (!of_find_property(np, "cooling-levels", NULL))
> 		return 0;
> 
> 	ret = of_property_count_u32_elems(np, "cooling-levels");
> 	if (ret <= 0) {
> 		dev_err(dev, "Wrong data!\n");
> 		return ret;

This should probably be something like 

		return ret ? : -EINVAL;

or ret == 0 is not an error, and you should not display an error message
in that case.

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ