提交 63d762b8 编写于 作者: D Dan Carpenter 提交者: Andy Shevchenko

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: 58cbbee2 ("x86/platform/mellanox: Introduce support for Mellanox systems platform")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NVadim Pasternak <vadimp@mellanox.com>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
上级 49def185
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册