[PATCH v3 2/3] watchdog: add designware driver

Sascha Hauer s.hauer at pengutronix.de
Mon Nov 14 07:14:32 PST 2016


On Mon, Oct 17, 2016 at 09:50:51AM +0200, Steffen Trumtrar wrote:
> Port the linux v4.8-rc1 Synopsys DesignWare watchdog driver to barebox.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
> ---
> +static void __noreturn dw_wdt_restart_handle(struct restart_handler *rst)
> +{
> +	struct dw_wdt *dw_wdt;
> +
> +	dw_wdt = container_of(rst, struct dw_wdt, restart);
> +
> +	dw_wdt->wdd.set_timeout(&dw_wdt->wdd, -1);
> +
> +	mdelay(1000);
> +
> +	hang();
> +}
> +
> +static int dw_wdt_drv_probe(struct device_d *dev)
> +{
> +	struct watchdog *wdd;
> +	struct dw_wdt *dw_wdt;
> +	struct resource *mem;
> +	int ret;
> +
> +	dw_wdt = xzalloc(sizeof(*dw_wdt));
> +
> +	mem = dev_request_mem_resource(dev, 0);
> +	dw_wdt->regs = IOMEM(mem->start);
> +	if (IS_ERR(dw_wdt->regs))
> +		return PTR_ERR(dw_wdt->regs);

Just stumbled upon this. The result of dev_request_mem_resource() must
be error checked, not the IOMEM(). If mem is valid then IOMEM() is valid
aswell.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list