platform/x86: mlx-platform: free first dev on error
Subsystems (2)
PATCH 1/1 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 <[email protected]>
drivers/platform/x86/mlx-platform.c +1 -1
@@ -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:
Quoted 10 lines
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Saturday, January 07, 2017 8:34 AM
To: Vadim Pasternak <[email protected]>
Cc: Darren Hart <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: [patch] platform/x86: mlx-platform: free first dev on error
Quoted 7 lines
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 forMellanox systems platform")
Signed-off-by Dan Carpenter <[email protected]>
Acked-by Vadim Pasternak <[email protected]>
Quoted 14 lines
drivers/platform/x86/mlx- renamed from drivers/platform/x86/mlx-platform.c +0
-0
platform.c
index04e1f2b30fa6..8f98c211b440100644drivers/platform/x86/mlx-platform.c +1
-1@@ -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: