Re: [PATCH] MIPS: TXx9: Add missing iounmap

From: James Hogan
Date: Mon Mar 05 2018 - 17:37:45 EST


On Thu, Nov 23, 2017 at 10:49:55PM +0100, Vasyl Gomonovych wrote:
> Add the missing iounmap() before put_device and
> return from txx9_sramc_init().
>
> Signed-off-by: Vasyl Gomonovych <gomonovych@xxxxxxxxx>
> ---
> arch/mips/txx9/generic/setup.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
> index 1791a44ee570..6ef5edb85d68 100644
> --- a/arch/mips/txx9/generic/setup.c
> +++ b/arch/mips/txx9/generic/setup.c
> @@ -965,6 +965,8 @@ void __init txx9_sramc_init(struct resource *r)
> }
> return;
> exit_put:
> + if (dev->base)
> + iounmap(dev->base);

I think if dev->base was NULL then a different error path would have
been taken already.

More concerning to be honest though is the sysfs_create_bin_file() error
handling just above here, which seems to iounmap() and kfree() *after*
device_unregister(). txx9_device_release() already kfrees it.

The iounmap() call should prresumably move before the kfree() in
txx9_device_release(), and the kfree() after device_unregister() should
be removed?

Cheers
James

> put_device(&dev->dev);
> return;
> }
> --
> 1.9.1
>

Attachment: signature.asc
Description: Digital signature