[U-Boot] drivers/ifc:Typecast argument to kfree

Scott Wood scottwood at freescale.com
Fri May 22 22:28:41 CEST 2015


On Wed, May 20, 2015 at 02:47:15PM +0530, Raghav Dogra wrote:
> kfree accepts the argument having type void *
> Typecasting priv to match it
> 
> Signed-off-by: Raghav Dogra <raghav at freescale.com>
> ---
>  drivers/mtd/nand/fsl_ifc_nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
> index 79fa88b..7ddc7e8 100644
> --- a/drivers/mtd/nand/fsl_ifc_nand.c
> +++ b/drivers/mtd/nand/fsl_ifc_nand.c
> @@ -909,7 +909,7 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr)
>  	if (priv->bank >= MAX_BANKS) {
>  		printf("%s: address did not match any "
>  		       "chip selects\n", __func__);
> -		kfree(priv);
> +		kfree((void *)priv);
>  		return -ENODEV;
>  	}

There is no need to do this.  Unnecessary casts harm legibility and
reduce safety.

-Scott


More information about the U-Boot mailing list