From: Doug Anderson <dianders@chromium.org>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: Fabio Porcedda <fabio.porcedda@gmail.com>,
Sachin Kamat <sachin.kamat@linaro.org>,
Guenter Roeck <linux@roeck-us.net>,
Doug Anderson <dianders@chromium.org>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] watchdog: core: Fix watchdog_init_timeout() when invalid param / valid dt
Date: Tue, 26 Nov 2013 10:22:53 -0800 [thread overview]
Message-ID: <1385490173-7511-2-git-send-email-dianders@chromium.org> (raw)
In-Reply-To: <1385490173-7511-1-git-send-email-dianders@chromium.org>
There was a minor bug in watchdog_init_timeout() where it would return
an error code if someone specified an invalid parameter on the
command line but then there was a valid parameter in the device tree
as "timeout-sec".
Signed-off-by: Doug Anderson <dianders@chromium.org>
---
drivers/watchdog/watchdog_core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index cec9b55..8d27753 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -82,12 +82,12 @@ int watchdog_init_timeout(struct watchdog_device *wdd,
wdd->timeout = timeout_parm;
return ret;
}
- if (timeout_parm)
- ret = -EINVAL;
- /* try to get the timeout_sec property */
+ /* if no device tree then we're done */
if (dev == NULL || dev->of_node == NULL)
- return ret;
+ return (timeout_parm) ? -EINVAL : ret;
+
+ /* try to get the timeout_sec property */
of_property_read_u32(dev->of_node, "timeout-sec", &t);
if (!watchdog_timeout_invalid(wdd, t) && t)
wdd->timeout = t;
--
1.8.4.1
next prev parent reply other threads:[~2013-11-26 18:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 18:22 [PATCH 1/2] watchdog: core: Make dt "timeout-sec" property work on drivers w/out min/max Doug Anderson
2013-11-26 18:22 ` Doug Anderson [this message]
2013-11-26 18:58 ` [PATCH 2/2] watchdog: core: Fix watchdog_init_timeout() when invalid param / valid dt Guenter Roeck
2013-11-26 19:23 ` Doug Anderson
2013-11-26 19:51 ` Guenter Roeck
2013-11-26 18:58 ` [PATCH 1/2] watchdog: core: Make dt "timeout-sec" property work on drivers w/out min/max 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=1385490173-7511-2-git-send-email-dianders@chromium.org \
--to=dianders@chromium.org \
--cc=fabio.porcedda@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sachin.kamat@linaro.org \
--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).