RE: [patch] platform/x86: mlx-platform: free first dev on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx]
> Sent: Saturday, January 07, 2017 8:34 AM
> To: Vadim Pasternak <vadimp@xxxxxxxxxxxx>
> Cc: Darren Hart <dvhart@xxxxxxxxxxxxx>; platform-driver-
> x86@xxxxxxxxxxxxxxx; kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [patch] platform/x86: mlx-platform: free first dev on error
> 
> There is an off-by-one error so we don't unregister priv->pdev_mux[0].
> Also it's slightly simpler as a while loop instead of a for loop.
> 
> Fixes: 58cbbee2391c ("x86/platform/mellanox: Introduce support for
> Mellanox systems platform")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 

Acked-by: Vadim Pasternak <vadimp@xxxxxxxxxxxx>

> diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-
> platform.c
> index 04e1f2b30fa6..8f98c211b440 100644
> --- a/drivers/platform/x86/mlx-platform.c
> +++ b/drivers/platform/x86/mlx-platform.c
> @@ -342,7 +342,7 @@ static int __init mlxplat_init(void)
>  	return 0;
> 
>  fail_platform_mux_register:
> -	for (i--; i > 0 ; i--)
> +	while (--i >= 0)
>  		platform_device_unregister(priv->pdev_mux[i]);
>  	platform_device_unregister(priv->pdev_i2c);
>  fail_alloc:
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux