[PATCH 1/6] cfi_flash: fix missing resource update when probing the cfi size

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 2 04:17:48 EDT 2012


On Fri, Mar 30, 2012 at 06:47:51AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> introduce in commit 8262d20dae583a
> "cfi: convert to struct resource"
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
>  drivers/nor/cfi_flash.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
> index 654e647..267c95b 100644
> --- a/drivers/nor/cfi_flash.c
> +++ b/drivers/nor/cfi_flash.c
> @@ -989,6 +989,11 @@ static int cfi_probe (struct device_d *dev)
>  	info->base = dev_request_mem_region(dev, 0);
>  	info->size = flash_get_size(info);
>  
> +	if (dev->resource[0].size == 0) {
> +		printf("cfi_probe: size : 0x%08lx\n", info->size);
> +		dev->resource[0].size = info->size;
> +	}

Not good. If we don't know the actual flash size, dev->resource[0].size
should have the maximum size and not 0. We can't simply manipulate the
resource size after having requested it.

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