linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Martyn Welch <martyn.welch@collabora.co.uk>,
	Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v3 2/2] Zodiac Aerospace RAVE Switch Watchdog Processor Driver
Date: Wed, 25 Nov 2015 08:10:02 -0800	[thread overview]
Message-ID: <5655DD5A.8030705@roeck-us.net> (raw)
In-Reply-To: <5655D566.30300@collabora.co.uk>

Hi Martyn,

On 11/25/2015 07:36 AM, Martyn Welch wrote:
>
[ ... ]

>>> +
>>> +#define ZIIRAVE_REASON_POWER_UP    0x0
>>> +#define ZIIRAVE_REASON_HW_WDT    0x1
>>> +#define ZIIRAVE_REASON_HOST_REQ    0x4
>>> +#define ZIIRAVE_REASON_IGL_CFG    0x6
>>> +#define ZIIRAVE_REASON_IGL_INST    0x7
>>> +#define ZIIRAVE_REASON_IGL_TRAP    0x8
>>> +#define ZIIRAVE_REASON_UNKNOWN    0x9
>>> +
>>> +static char *ziirave_reasons[] = {"power cycle", "triggered", "host request",
>>> +                  "illegal configuration",
>>> +                  "illegal instruction", "illegal trap",
>>> +                  "unknown"};
>>> +
>>
>> I don't see mapping code from the reason values to the array.
>> "host request" is array index 2 but the defined value is 0x4.
>>
>> Am I missing something ?
>>
>
> Whoops, missed that. I guess the simplest thing to do is pad out the array?
>
I thought you wanted to check if I really read your code :-).

Yes, padding would probably be the simplest solution, though question is
what to do with undefined values. Maybe pad with NULL and also check if
ziirave_reasons[x] is not NULL ?


>>> +    /*
>>> +     * The default value set in the watchdog should be perfectly valid, so
>>> +     * pass that in if we haven't provided one via the module parameter or
>>> +     * of property.
>>> +     */
>>> +    if (w_priv->wdd.timeout == 0) {
>>> +        val = i2c_smbus_read_byte_data(client, ZIIRAVE_WDT_TIMEOUT);
>>> +        if (val < 0)
>>> +            return val;
>>> +
>>> +        w_priv->wdd.timeout = val;
>>
>> What if the returned value is 0 ?
>>
>
> Minimum timeout is 3, device won't accept a value below that and should never return a value
> below that.
>

Maybe add the following ?

	if (val < ZIIRAVE_TIMEOUT_MIN)
		return -ENODEV;

Thanks,
Guenter


  reply	other threads:[~2015-11-25 16:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 12:03 [PATCH v3 1/2] Add binding documentation for Zodiac Watchdog Timer Martyn Welch
2015-11-25 12:03 ` [PATCH v3 2/2] Zodiac Aerospace RAVE Switch Watchdog Processor Driver Martyn Welch
2015-11-25 14:52   ` Guenter Roeck
2015-11-25 15:36     ` Martyn Welch
2015-11-25 16:10       ` Guenter Roeck [this message]
2015-11-25 16:12         ` Martyn Welch
2015-11-25 17:15     ` [PATCH v4] " Martyn Welch
2015-11-30  9:30       ` Martyn Welch
2015-11-30 14:48         ` Guenter Roeck
2015-11-30 15:55       ` Guenter Roeck
2015-11-30 17:26         ` Martyn Welch
2015-11-30 18:10           ` Guenter Roeck
2015-12-01 10:13             ` [PATCH v5] " Martyn Welch
2015-12-01 15:19               ` Guenter Roeck
2015-12-01 15:32             ` [PATCH v6] watchdog: " Martyn Welch
2015-12-28 21:54               ` Wim Van Sebroeck
2015-11-25 20:06 ` [PATCH v3 1/2] Add binding documentation for Zodiac Watchdog Timer Rob Herring
2015-12-01 15:15 ` [v3,1/2] " Guenter Roeck
2015-12-01 15:38   ` Martyn Welch
2015-12-01 20:24     ` Guenter Roeck

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=5655DD5A.8030705@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=martyn.welch@collabora.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).