From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 3/5] watchdog: ts4800: add driver for TS-4800 watchdog
Date: Mon, 23 Nov 2015 18:32:15 -0800 [thread overview]
Message-ID: <5653CC2F.8080608@roeck-us.net> (raw)
In-Reply-To: <1448291861-28543-4-git-send-email-damien.riegel@savoirfairelinux.com>
Hi Damien,
On 11/23/2015 07:17 AM, Damien Riegel wrote:
> This watchdog is instantiated in a FPGA that is memory mapped. It is
> made of only one register, called the feed register. Writing to this
> register will re-arm the watchdog for a given time (and enable it if it
> was disable). It can be disabled by writing a special value into it.
>
> It is part of a syscon block, and the watchdog register offset in this
> block varies from board to board. This offset is passed in the syscon
> property after the phandle to the syscon node.
>
> Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
> ---
[ ... ]
> +
> +static int ts4800_wdt_set_timeout(struct watchdog_device *wdd,
> + unsigned int timeout)
> +{
> + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd);
> + int i;
> +
> + for (i = 0; i <= MAX_TIMEOUT_INDEX; i++) {
> + if (ts4800_wdt_map[i].timeout >= timeout)
> + break;
> + }
If the loop does not break, i will have a value of MAX_TIMEOUT_INDEX + 1,
or 2, pointing after the end of the table. That should never happen,
but still ...
I preferred the earlier version, where you had an extra function.
Only my suggestion was to have that function return MAX_TIMEOUT_INDEX
instead of an error. Alternatively, the check above needs to be
"i < MAX_TIMEOUT_INDEX".
Guenter
next prev parent reply other threads:[~2015-11-24 2:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 15:17 [PATCH v4 0/5] Add board support for TS-4800 Damien Riegel
2015-11-23 15:17 ` [PATCH v4 1/5] of: add vendor prefix for Technologic Systems Damien Riegel
2015-11-23 15:17 ` [PATCH v4 2/5] mfd: syscon: add a DT property to set value width Damien Riegel
2015-11-23 15:19 ` Arnd Bergmann
2015-11-24 8:20 ` Lee Jones
2015-11-24 16:24 ` Damien Riegel
2015-11-24 17:22 ` Lee Jones
2015-11-24 17:23 ` Lee Jones
2015-11-23 15:17 ` [PATCH v4 3/5] watchdog: ts4800: add driver for TS-4800 watchdog Damien Riegel
2015-11-24 2:32 ` Guenter Roeck [this message]
2015-11-24 2:55 ` Damien Riegel
2015-11-23 15:17 ` [PATCH v4 4/5] ARM: imx_v6_v7_defconfig: add " Damien Riegel
2015-11-23 15:17 ` [PATCH v4 5/5] ARM: dts: TS-4800: add basic device tree Damien Riegel
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=5653CC2F.8080608@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-arm-kernel@lists.infradead.org \
/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).