[PATCH v2] nvmem: regmap: Fix nvmem size

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Dec 20 01:00:20 PST 2023


Hello Robin,

Thanks for the fix.

On 20.12.23 09:29, Robin van der Gracht wrote:
> -	if (roffset + rbytes > stride * regmap_get_max_register(map))
> +	if (roffset + rbytes > regmap_size_bytes(map) * stride)

Shouldn't stride on the right hand side be dropped?

Cheers,
Ahmad

>  		return -EINVAL;
>  
>  	for (i = roffset; i < roffset + rbytes; i += stride) {
> @@ -78,7 +78,7 @@ nvmem_regmap_register_with_pp(struct regmap *map, const char *name,
>  	config.priv = map;
>  	config.stride = 1;
>  	config.word_size = 1;
> -	config.size = regmap_get_max_register(map) * regmap_get_reg_stride(map);
> +	config.size = regmap_size_bytes(map) * regmap_get_reg_stride(map);
>  	config.cell_post_process = cell_post_process;
>  	config.reg_write = nvmem_regmap_write;
>  	config.reg_read = nvmem_regmap_read;

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list