[patch v11 12/12] platform/mellanox: Add validation of return code of hotplug device creation routine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding validation of return code of mlxreg_hotplug_device_create. It could
fail in case the requested adapter is not available or if client can not
be connected to the adapter. Error is to be reported in case of bad flow.

Signed-off-by: Vadim Pasternak <vadimp@xxxxxxxxxxxx>
---
 drivers/platform/mellanox/mlxreg-hotplug.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
index c806451..e852219 100644
--- a/drivers/platform/mellanox/mlxreg-hotplug.c
+++ b/drivers/platform/mellanox/mlxreg-hotplug.c
@@ -263,13 +263,15 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv,
 			if (item->inversed)
 				mlxreg_hotplug_device_destroy(data);
 			else
-				mlxreg_hotplug_device_create(data);
+				ret = mlxreg_hotplug_device_create(data);
 		} else {
 			if (item->inversed)
-				mlxreg_hotplug_device_create(data);
+				ret = mlxreg_hotplug_device_create(data);
 			else
 				mlxreg_hotplug_device_destroy(data);
 		}
+		if (ret)
+			dev_err(priv->dev, "Failed to create hotplug device.\n");
 	}
 
 	/* Acknowledge event. */
@@ -312,8 +314,11 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv,
 		if (regval == MLXREG_HOTPLUG_HEALTH_MASK) {
 			if ((data->health_cntr++ == MLXREG_HOTPLUG_RST_CNTR) ||
 			    !priv->after_probe) {
-				mlxreg_hotplug_device_create(data);
-				data->attached = true;
+				ret = mlxreg_hotplug_device_create(data);
+				if (ret)
+					dev_err(priv->dev, "Failed to create hotplug device.\n");
+				else
+					data->attached = true;
 			}
 		} else {
 			if (data->attached) {
-- 
2.1.4




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux