From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YIEaD-0007rp-Il for barebox@lists.infradead.org; Mon, 02 Feb 2015 10:50:22 +0000 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0] ident=Debian-exim) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1YIEZp-00060p-QI for barebox@lists.infradead.org; Mon, 02 Feb 2015 11:49:57 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1YIEZp-000454-OX for barebox@lists.infradead.org; Mon, 02 Feb 2015 11:49:57 +0100 Date: Mon, 2 Feb 2015 11:49:57 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Message-ID: <20150202104957.GA10842@pengutronix.de> References: <1422366061-26735-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1422366061-26735-1-git-send-email-u.kleine-koenig@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH] watchdog: imx: error out on negative timeouts To: barebox@lists.infradead.org Hello, On Tue, Jan 27, 2015 at 02:41:01PM +0100, Uwe Kleine-K=F6nig wrote: > I'm not sure where a negative timeout could come from but making the > code more robust for no additional runtime cost is good nevertheless. > = > Signed-off-by: Uwe Kleine-K=F6nig > --- > drivers/watchdog/imxwd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > = > diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c > index 31c3d0d85353..66e9f6848f74 100644 > --- a/drivers/watchdog/imxwd.c > +++ b/drivers/watchdog/imxwd.c > @@ -87,7 +87,7 @@ static int imx21_watchdog_set_timeout(struct imx_wd *pr= iv, int timeout) > = > dev_dbg(priv->dev, "%s: %d\n", __func__, timeout); > = > - if (!timeout || timeout > 128) > + if (timeout <=3D 0 || timeout > 128) > return -EINVAL; This patch is broken because reset_cpu (in the same source file) calls set_timeout with timeout=3D-1 to reset the cpu immediatly. The wd command only parses non-negative values, so from there nothing strange should be expected. Returning -EINVAL on timeout=3D0 (which means "disable watchdog") is OK because the imx21 watchdog cannot be stopped. So in short: please drop this patch from next. Thanks Uwe -- = Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox