提交 7805fa8d 编写于 作者: V Vadim Pasternak 提交者: Darren Hart (VMware)

platform/mellanox: mlxreg-hotplug: Add check for negative adapter number

Verify before creation of hotplug device if the associated adapter number
is negative. It could be in case hotplug event is not associated with
hotplug device.
Signed-off-by: NVadim Pasternak <vadimp@mellanox.com>
Signed-off-by: NDarren Hart (VMware) <dvhart@infradead.org>
上级 0b78b1c2
......@@ -96,6 +96,13 @@ struct mlxreg_hotplug_priv_data {
static int mlxreg_hotplug_device_create(struct device *dev,
struct mlxreg_core_data *data)
{
/*
* Return if adapter number is negative. It could be in case hotplug
* event is not associated with hotplug device.
*/
if (data->hpdev.nr < 0)
return 0;
data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr);
if (!data->hpdev.adapter) {
dev_err(dev, "Failed to get adapter for bus %d\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册