Re: [PATCH v6 2/2] watchdog: Add Renesas RZ/N1 Watchdog driver

From: Geert Uytterhoeven
Date: Wed Apr 27 2022 - 08:32:36 EST


Hi Jean-Jacques,

On Wed, Apr 13, 2022 at 10:25 AM Jean-Jacques Hiblot
<jjhiblot@xxxxxxxxxxxxxxx> wrote:
> From: Phil Edworthy <phil.edworthy@xxxxxxxxxxx>
>
> This is a driver for the standard WDT on the RZ/N1 devices. This WDT has
> very limited timeout capabilities. However, it can reset the device.
> To do so, the corresponding bits in the SysCtrl RSTEN register need to
> be enabled. This is not done by this driver.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@xxxxxxxxxxx>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@xxxxxxxxxxxxxxx>
> Reviewed-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>

Thanks for your patch!

> --- /dev/null
> +++ b/drivers/watchdog/rzn1_wdt.c

> +static int rzn1_wdt_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct rzn1_watchdog *wdt;
> + struct device_node *np = dev->of_node;
> + struct clk *clk;
> + int ret;
> + int irq;
> +
> + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
> + if (!wdt)
> + return -ENOMEM;
> +
> + wdt->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(wdt->base))
> + return PTR_ERR(wdt->base);
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;
> +
> + ret = devm_request_irq(dev, irq, rzn1_wdt_irq, 0,
> + np->name, wdt);
> + if (ret) {
> + dev_err(dev, "failed to request irq %d\n", irq);
> + return ret;
> + }
> +
> + clk = devm_clk_get(dev, NULL);
> + if (IS_ERR(clk)) {
> + dev_err(dev, "failed to get the clock\n");
> + return PTR_ERR(clk);
> + }
> +
> + ret = clk_prepare_enable(clk);
> + if (ret) {
> + dev_err(dev, "failed to prepare/enable the clock\n");
> + return ret;
> + }
> +
> + ret = devm_add_action_or_reset(dev, rzn1_wdt_clk_disable_unprepare,
> + clk);
> + if (ret) {
> + dev_err(dev, "failed to register clock unprepare callback\n");

Please remove this error message.
devm_add_action_or_reset() only fails when running out of memory,
in which case the memory allocation core has already printed an
error message.

> + return ret;
> + }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds