diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-01-07 01:33:34 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-01 02:33:13 -0500 |
commit | adb260d15134f3aabd6e1bf39ee7f4ea28385c2d (patch) | |
tree | daccd36f0a330d2be3354faf8f5db63c93737c9c /arch/x86 | |
parent | 776050a9b55e17b72b5684794b9580d72e920e17 (diff) |
platform/x86: mlx-platform: free first dev on error
commit 63d762b88cb5510f2bfdb5112ced18cde867ae61 upstream.
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@oracle.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/platform/mellanox/mlx-platform.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/platform/mellanox/mlx-platform.c b/arch/x86/platform/mellanox/mlx-platform.c index 7dcfcca97399..c0355d789fce 100644 --- a/arch/x86/platform/mellanox/mlx-platform.c +++ b/arch/x86/platform/mellanox/mlx-platform.c | |||
@@ -233,7 +233,7 @@ static int __init mlxplat_init(void) | |||
233 | return 0; | 233 | return 0; |
234 | 234 | ||
235 | fail_platform_mux_register: | 235 | fail_platform_mux_register: |
236 | for (i--; i > 0 ; i--) | 236 | while (--i >= 0) |
237 | platform_device_unregister(priv->pdev_mux[i]); | 237 | platform_device_unregister(priv->pdev_mux[i]); |
238 | platform_device_unregister(priv->pdev_i2c); | 238 | platform_device_unregister(priv->pdev_i2c); |
239 | fail_alloc: | 239 | fail_alloc: |