[<prev] [next>] [day] [month] [year] [list]
Message-ID: <53A93304.9000604@nsn.com>
Date: Tue, 24 Jun 2014 10:12:52 +0200
From: Alexander Sverdlin <alexander.sverdlin@....com>
To: ext Pantelis Antoniou <pantelis.antoniou@...sulko.com>,
Ioan Nicu <ioan.nicu.ext@....com>
CC: Grant Likely <grant.likely@...retlab.ca>,
Rob Herring <robherring2@...il.com>,
Stephen Warren <swarren@...dotorg.org>,
Matt Porter <matt.porter@...aro.org>,
Koen Kooi <koen@...inion.thruhere.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alison Chaiken <Alison_Chaiken@...tor.com>,
Dinh Nguyen <dinh.linux@...il.com>,
Jan Lubbe <jluebbe@...net.de>, Michael Stickel <ms@...able.de>,
Guenter Roeck <linux@...ck-us.net>,
Dirk Behme <dirk.behme@...il.com>,
Alan Tull <delicious.quinoa@...il.com>,
Sascha Hauer <s.hauer@...gutronix.de>,
Michael Bohan <mbohan@...eaurora.org>,
Michal Simek <monstr@...str.eu>,
Matt Ranostay <mranostay@...il.com>,
Joel Becker <jlbec@...lplan.org>, devicetree@...r.kernel.org,
Wolfram Sang <wsa@...-dreams.de>, linux-i2c@...r.kernel.org,
Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, Pete Popov <pete.popov@...sulko.com>,
Dan Malek <dan.malek@...sulko.com>,
Georgi Vlaev <georgi.vlaev@...sulko.com>
Subject: Re: [PATCH 5/6] OF: Utility helper functions for dynamic nodes
Hi!
On 23/06/14 21:13, ext Pantelis Antoniou wrote:
[...]
>>> I don't know of any place in the kernel accessing the value if prop->length==0
>>>
>>
>> We have a simple use case. We have an overlay which adds an interrupt controller.
>> If you look in drivers/of/irq.c, in of_irq_parse_raw():
>>
>> [...]
>> /* Now start the actual "proper" walk of the interrupt tree */
>> while (ipar != NULL) {
>> /* Now check if cursor is an interrupt-controller and if it is
>> * then we are done
>> */
>> if (of_get_property(ipar, "interrupt-controller", NULL) !=
>> NULL) {
>> pr_debug(" -> got it !\n");
>> return 0;
>> }
>> [...]
>>
>> A node is identified as an interrupt controller if it has a zero-length property
>> called "interrupt-controller" but with a non-NULL value.
>>
>> My proposed fix for this was to remove the if () condition. propn->value will be
>> allocated with kmalloc(0) which returns ZERO_SIZE_PTR which is != NULL.
>>
>
> If that's the case, the code in irq.c is wrong.
>
> interrupt-controller is a bool property; the correct call to use is of_property_read_bool()
> which returns true or false when the value is defined.
No, it's not bool... It's an existence of a void property.
> The use of of_get_property is a bug here. It is perfectly valid for a property to have a
> NULL value when length = 0.
of_find_property() would be really correct in this particular case...
--
Best regards,
Alexander Sverdlin.
--
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