Re: [PATCH v2] console: console: Complete exception handling in newport_probe()

From: Andy Shevchenko
Date: Thu Apr 23 2020 - 10:52:18 EST


On Thu, Apr 23, 2020 at 5:26 PM Dejin Zheng <zhengdejin5@xxxxxxxxx> wrote:
>
> A call of the function ÂÂdo_take_over_consoleÂÂ can fail here.
> The corresponding system resources were not released then.
> Thus add a call of the function ÂÂiounmapÂÂ together with the check
> of a failure predicate.

...

> CC: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>

Use Cc: Better to read.

...

> v1 -> v2:
> - modify the commit comments by Markus'suggestion.

What suggestion? You need to be clear in changelog what exactly has
been done without looking to any previous mail.

...

> console_lock();
> err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
> console_unlock();
> +
> + if (err)
> + iounmap((void *)npregs);
> return err;
> }

I have briefly looked at the code (it is actually quite old one!), and
I think this is half-baked solution, besides the fact of missed
__iomem annotation and useless explicit casting.
The proper one seems to switch to memremap() and do memunmap() here.

--
With Best Regards,
Andy Shevchenko