All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@men.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Johannes Thumshirn <johannes.thumshirn@men.de>, <wim@iguana.be>,
	<linux-kernel@vger.kernel.org>, <linux-watchdog@vger.kernel.org>,
	<guenter@roeck-us.net>
Subject: Re: [PATCH v8] watchdog: New watchdog driver for MEN A21 watchdogs
Date: Fri, 14 Jun 2013 09:39:48 +0200	[thread overview]
Message-ID: <20130614073948.GA9438@jtlinux> (raw)
In-Reply-To: <20130614035533.GC6980@roeck-us.net>

On Thu, Jun 13, 2013 at 08:55:33PM -0700, Guenter Roeck wrote:
[...]
> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.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

  reply	other threads:[~2013-06-14  7:36 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31  8:58 [PATCH v5 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Johannes Thumshirn
2013-05-31  9:01 ` [PATCH v2 2/2] This patch adds a sysfs interface for the watchdog device found on MEN A21 Boards Johannes Thumshirn
2013-05-31  9:04 ` [PATCH v5 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Johannes Thumshirn
2013-05-31 10:36 ` Guenter Roeck
2013-05-31 10:53   ` Johannes Thumshirn
2013-05-31 11:08   ` [PATCH v6] " Johannes Thumshirn
2013-05-31 11:40     ` Guenter Roeck
2013-05-31 12:55       ` Johannes Thumshirn
2013-06-01  4:15         ` Guenter Roeck
2013-06-03  9:50           ` Johannes Thumshirn
2013-06-06 10:51             ` Some problems with sysfs patch (was Re: [PATCH v6] watchdog: New watchdog driver for MEN A21 watchdogs) Johannes Thumshirn
2013-06-06 11:31               ` Guenter Roeck
2013-06-06 13:00                 ` Johannes Thumshirn
2013-06-06 17:08                   ` Guenter Roeck
2013-06-07  7:45                     ` Johannes Thumshirn
2013-06-07  9:14                       ` Guenter Roeck
2013-06-07  9:49                         ` Johannes Thumshirn
2013-05-31 13:32       ` [PATCH v7] watchdog: New watchdog driver for MEN A21 watchdogs Johannes Thumshirn
2013-06-01 15:28         ` Guenter Roeck
2013-06-03 14:34       ` [PATCH v8] " Johannes Thumshirn
2013-06-07  9:55         ` [PATCH v8 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-06-14  3:55         ` [PATCH v8] watchdog: New watchdog driver for MEN A21 watchdogs Guenter Roeck
2013-06-14  7:39           ` Johannes Thumshirn [this message]
2013-06-14 10:58         ` [PATCH v9] " Johannes Thumshirn
2013-06-14 11:19           ` [PATCH v9 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-06-16 22:07           ` [PATCH v9] watchdog: New watchdog driver for MEN A21 watchdogs Guenter Roeck
2013-06-17  6:40             ` Johannes Thumshirn
2013-06-17 10:22             ` [PATCH v10 1/2] " Johannes Thumshirn
2013-06-17 10:24               ` [PATCH v10 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-06-17 14:00               ` [PATCH v10 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Guenter Roeck
2013-06-18 15:19                 ` [PATCH RESEND " Johannes Thumshirn
2013-06-18 15:21                   ` [PATCH RESEND v10 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-07-01  7:32                     ` Johannes Thumshirn
2013-07-05 21:03                     ` Wim Van Sebroeck
2013-07-08  7:06                       ` Johannes Thumshirn
2013-07-05 21:01                   ` [PATCH RESEND v10 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Wim Van Sebroeck
2013-07-08  6:59                     ` Johannes Thumshirn
2013-06-01  8:56 ` [PATCH v5 " Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130614073948.GA9438@jtlinux \
    --to=johannes.thumshirn@men.de \
    --cc=guenter@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.