diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-01-07 09:33:34 +0300 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-01-21 01:43:42 +0200 |
commit | 63d762b88cb5510f2bfdb5112ced18cde867ae61 (patch) | |
tree | 59bd1832e251b5e0edc61b1b6fb4f4d448b57554 /drivers/platform | |
parent | 49def1853334396f948dcb4cedb9347abb318df5 (diff) | |
download | linux-63d762b88cb5510f2bfdb5112ced18cde867ae61.tar.gz linux-63d762b88cb5510f2bfdb5112ced18cde867ae61.tar.bz2 linux-63d762b88cb5510f2bfdb5112ced18cde867ae61.zip |
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@oracle.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/mlx-platform.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 97b4c3a219c0..25f15df5c2d7 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -326,7 +326,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: |