summaryrefslogtreecommitdiff
path: root/drivers/staging/qlge/qlge_devlink.c
diff options
context:
space:
mode:
authorCoiby Xu <coiby.xu@gmail.com>2021-03-24 09:00:01 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-26 14:58:13 +0100
commitd8827ae8e22badd339e1b6225c03a1e417765a3d (patch)
treecea07892f588a2a44038ba44d7b0b709e8d0f1ba /drivers/staging/qlge/qlge_devlink.c
parent9c15db92a8e56bcde0f58064ac1adc28c0579b51 (diff)
staging: qlge: deal with the case that devlink_health_reporter_create fails
devlink_health_reporter_create may fail. In that case, do the cleanup work. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Coiby Xu <coxu@redhat.com> Link: https://lore.kernel.org/r/20210324010002.109846-1-coxu@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/qlge/qlge_devlink.c')
-rw-r--r--drivers/staging/qlge/qlge_devlink.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c
index 86834d96cebf..0ab02d6d3817 100644
--- a/drivers/staging/qlge/qlge_devlink.c
+++ b/drivers/staging/qlge/qlge_devlink.c
@@ -148,16 +148,20 @@ static const struct devlink_health_reporter_ops qlge_reporter_ops = {
.dump = qlge_reporter_coredump,
};
-void qlge_health_create_reporters(struct qlge_adapter *priv)
+long qlge_health_create_reporters(struct qlge_adapter *priv)
{
struct devlink *devlink;
+ long err = 0;
devlink = priv_to_devlink(priv);
priv->reporter =
devlink_health_reporter_create(devlink, &qlge_reporter_ops,
0, priv);
- if (IS_ERR(priv->reporter))
+ if (IS_ERR(priv->reporter)) {
+ err = PTR_ERR(priv->reporter);
netdev_warn(priv->ndev,
"Failed to create reporter, err = %ld\n",
- PTR_ERR(priv->reporter));
+ err);
+ }
+ return err;
}