[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190416211413.GB26442@roeck-us.net>
Date: Tue, 16 Apr 2019 14:14:13 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Wolfram Sang <wsa@...-dreams.de>
Cc: Jerry Hoemann <jerry.hoemann@....com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
linux-watchdog@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 06/16] watchdog: hpwdt: drop warning after calling
watchdog_init_timeout
On Tue, Apr 16, 2019 at 10:50:03PM +0200, Wolfram Sang wrote:
> Hi Jerry,
>
> > I applied patches 1,2 & 6 in testing.
> >
> > Note, that hpwdt is passing NULL as the third parameter to watchdog_init_timeout().
> >
> > The second patch in this series is using "dev" as input to dev_err and dev_warn.
> >
> > This results in the following in dmesg when trying to load hpwdt w/ an invalid soft_margin:
> >
> >
> > [ 80.848160] (NULL device *): driver supplied timeout (4294967295) out of range
> > [ 80.855429] (NULL device *): falling back to default timeout (30)
>
> Thank you for this report. Yes, using 'dev' blindly is a bug.
>
> > if the call in hpwdt driver is changed to:
> >
> > if (watchdog_init_timeout(&hpwdt_dev, soft_margin, &dev->dev))
> >
> >
> > We see the message like we'd desire:
> >
> > [ 2061.167100] hpwdt 0000:01:00.0: driver supplied timeout (4294967295) out of range
> > [ 2061.174633] hpwdt 0000:01:00.0: falling back to default timeout (30)
>
> The above observation makes sense, but I think we should fix the core
> code and not the hpwdt driver. My suggestion would be to add something
> like this to watchdog_init_timeout():
>
> struct device *err_dev = dev ?: wdd->parent;
>
> And then use err_dev for all the printing. Guenter?
>
That is a good idea, and we should do that. Unfortunately, wdd->parent can also
be NULL, either because there is no parent device (e.g. softdog.c), or because
the driver author forgot to set ->parent. So we still need a fallback.
Does it make sense to print watchdog_info->identity if both dev and wdd->parent
are NULL ?
Guenter
Powered by blists - more mailing lists