diff options
author | Vadim Pasternak <vadimp@mellanox.com> | 2018-01-26 19:03:45 +0000 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2018-01-31 10:36:50 -0800 |
commit | 7805fa8d78d0ea8c9c5a6603960e8f23901c7f17 (patch) | |
tree | cb715478d1727adaf5a7f619d38e3d6a81b066e6 /drivers/platform/mellanox | |
parent | 0b78b1c2f43511cac53c5ab12b2235c31e3d41e5 (diff) |
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: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers/platform/mellanox')
-rw-r--r-- | drivers/platform/mellanox/mlxreg-hotplug.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c index bcb564fd9f04..0dfa1ca0d05b 100644 --- a/drivers/platform/mellanox/mlxreg-hotplug.c +++ b/drivers/platform/mellanox/mlxreg-hotplug.c @@ -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", |