Skip to content

Commit

Permalink
platform/x86: mlx-platform: free first dev on error
Browse files Browse the repository at this point in the history
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: 58cbbee ("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>
  • Loading branch information
Dan Carpenter authored and Andy Shevchenko committed Jan 20, 2017
1 parent 49def18 commit 63d762b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/platform/x86/mlx-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 63d762b

Please sign in to comment.