[PATCH 2/2] [media] stm32-dcmi: Improve four size determinations

Joe Perches joe at perches.com
Fri Sep 15 11:16:28 PDT 2017


On Fri, 2017-09-15 at 19:29 +0200, SF Markus Elfring wrote:
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
[]
> @@ -1372,9 +1372,8 @@ static int dcmi_formats_init(struct stm32_dcmi *dcmi)
>  	dcmi->sd_formats = devm_kcalloc(dcmi->dev,
> -					num_fmts, sizeof(struct dcmi_format *),
> +					num_fmts, sizeof(*dcmi->sd_formats),
>  					GFP_KERNEL);
>  	if (!dcmi->sd_formats)
>  		return -ENOMEM;
>  
> -	memcpy(dcmi->sd_formats, sd_fmts,
> -	       num_fmts * sizeof(struct dcmi_format *));
> +	memcpy(dcmi->sd_formats, sd_fmts, num_fmts * sizeof(*dcmi->sd_formats));

devm_kmemdup




More information about the linux-arm-kernel mailing list