lkml.org 
[lkml]   [2018]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] mtd: gpio_flash: add error handling for ioremap_nocache
On Fri, 22 Jun 2018 09:52:20 +0800
Zhouyang Jia <jiazhouyang09@gmail.com> wrote:

> When ioremap_nocache fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling ioremap_nocache.
>
> Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>

Applied.

Thanks,

Boris

> ---
> v1->v2:
> - Move the test just after the ioremap_nocache() call.
> ---
> drivers/mtd/maps/gpio-addr-flash.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
> index 385305e..9d97236 100644
> --- a/drivers/mtd/maps/gpio-addr-flash.c
> +++ b/drivers/mtd/maps/gpio-addr-flash.c
> @@ -239,6 +239,9 @@ static int gpio_flash_probe(struct platform_device *pdev)
> state->map.bankwidth = pdata->width;
> state->map.size = state->win_size * (1 << state->gpio_count);
> state->map.virt = ioremap_nocache(memory->start, state->map.size);
> + if (!state->map.virt)
> + return -ENOMEM;
> +
> state->map.phys = NO_XIP;
> state->map.map_priv_1 = (unsigned long)state;
>

\
 
 \ /
  Last update: 2018-07-07 12:00    [W:0.106 / U:2.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site