From: Vadim Pasternak <vadimp@mellanox.com>
To: dvhart@infradead.org, andy.shevchenko@gmail.com,
gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org, jiri@resnulli.us,
Vadim Pasternak <vadimp@mellanox.com>
Subject: [patch v11 12/12] platform/mellanox: Add validation of return code of hotplug device creation routine
Date: Wed, 24 Jan 2018 20:34:58 +0000 [thread overview]
Message-ID: <1516826098-125036-4-git-send-email-vadimp@mellanox.com> (raw)
In-Reply-To: <1516826098-125036-1-git-send-email-vadimp@mellanox.com>
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@mellanox.com>
---
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
next prev parent reply other threads:[~2018-01-24 20:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 20:34 [patch v11 09/12] platform/x86: mlx-platform: Simplify IO access to regmap context Vadim Pasternak
2018-01-24 20:34 ` [patch v11 10/12] platform/x86: mlx-platform: Extend register map configuration with IO access verification callbacks Vadim Pasternak
2018-01-25 22:16 ` Darren Hart
2018-01-24 20:34 ` [patch v11 11/12] platform/mellanox: mlxreg-hotplug: Add check for negative adapter number value Vadim Pasternak
2018-01-25 22:16 ` Darren Hart
2018-01-24 20:34 ` Vadim Pasternak [this message]
2018-01-25 22:28 ` [patch v11 12/12] platform/mellanox: Add validation of return code of hotplug device creation routine Darren Hart
2018-01-25 22:13 ` [patch v11 09/12] platform/x86: mlx-platform: Simplify IO access to regmap context Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516826098-125036-4-git-send-email-vadimp@mellanox.com \
--to=vadimp@mellanox.com \
--cc=andy.shevchenko@gmail.com \
--cc=dvhart@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®