[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50D07DFF.2040102@antcom.de>
Date: Tue, 18 Dec 2012 15:30:23 +0100
From: Roland Stigge <stigge@...com.de>
To: Mark Rutland <mark.rutland@....com>
CC: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"grant.likely@...retlab.ca" <grant.likely@...retlab.ca>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"w.sang@...gutronix.de" <w.sang@...gutronix.de>,
"jbe@...gutronix.de" <jbe@...gutronix.de>,
"plagnioj@...osoft.com" <plagnioj@...osoft.com>,
"highguy@...il.com" <highguy@...il.com>,
"broonie@...nsource.wolfsonmicro.com"
<broonie@...nsource.wolfsonmicro.com>,
"daniel-gl@....net" <daniel-gl@....net>,
"rmallon@...il.com" <rmallon@...il.com>, "sr@...x.de" <sr@...x.de>,
"wg@...ndegger.com" <wg@...ndegger.com>
Subject: Re: [PATCH RESEND 5/6 v10] gpio: Add device tree support to block
GPIO API
Hi Mark,
On 12/17/2012 04:51 PM, Mark Rutland wrote:
>> +static int __devinit gpioblock_of_probe(struct platform_device *pdev)
>> +{
>> + struct device_node *block;
>> + unsigned *gpios;
>> + int ngpio;
>> + int ret;
>> + struct gpio_block *gb;
>> +
>> + for_each_available_child_of_node(pdev->dev.of_node, block) {
>> + int i;
>> +
>> + ngpio = of_gpio_count(block);
>> + gpios = kzalloc(ngpio * sizeof(*gpios), GFP_KERNEL);
>
> What if the block node is malformed? ngpio might be -ENOENT or -EINVAL.
AFAICS, of_gpio_count() always returns at least 0. Both if
CONFIG_OF_GPIO is y, m or n. And called of_gpio_named_count() also
currently doesn't return error values. Further, other drivers using
of_gpio_count() don't expect or catch <0.
However, it's reasonable to guard against of_gpio_count() < 1 since
probing without provided blocks should be void.
Will change this for the next patch update together with your leakage
findings.
Thanks for reporting!
Roland
--
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