[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130614073948.GA9438@jtlinux>
Date: Fri, 14 Jun 2013 09:39:48 +0200
From: Johannes Thumshirn <johannes.thumshirn@....de>
To: Guenter Roeck <linux@...ck-us.net>
CC: Johannes Thumshirn <johannes.thumshirn@....de>, <wim@...ana.be>,
<linux-kernel@...r.kernel.org>, <linux-watchdog@...r.kernel.org>,
<guenter@...ck-us.net>
Subject: Re: [PATCH v8] watchdog: New watchdog driver for MEN A21 watchdogs
On Thu, Jun 13, 2013 at 08:55:33PM -0700, Guenter Roeck wrote:
[...]
> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....de>
>
> Almost good. One comment below.
>
> Thanks,
> Guenter
>
Nice to hear. Thanks for the review by the way.
[...]
> > +
> > + drv->num_gpios = of_gpio_count(node);
> > + if (drv->num_gpios <= 0) {
> > + dev_err(&pdev->dev, "gpios DT property empty / missing");
> > + return -ENODEV;
> > + }
>
> Not happy with this. Code accepts one gpio pin, but then assumes throughout the
> driver that all pins are defined. I am quite sure I can get it to crash if I
> specify only a single gpio pin. num_gpios will be 1, you allocate a single
> entry, but then access all 6 of them.
>
> I think it would be easier if you expect a fixed number of gpio pins (6) and abort
> if it is not correct. You can then make drv->gpios an array and don't have to
> allocate it separately, and you don't need drv->num_gpios (which you don't need
> anyway as it is not used outside this function).
>
Yup, you're right. Now that you're saying it I see it as well. This is probably a
copy'n'paste error from drivers/hwmon/gpio-fan.c.
@Wim are there any objections from your side?
Byte
Johannes
--
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