platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Pasternak <vadimp@nvidia.com>
To: <hdegoede@redhat.com>
Cc: <dan.carpenter@oracle.comq>,
	<platform-driver-x86@vger.kernel.org>,
	"Vadim Pasternak" <vadimp@nvidia.com>
Subject: [PATCH platform 3/4] platform/mellanox: Remove unnecessary code
Date: Tue, 23 Aug 2022 23:19:36 +0300	[thread overview]
Message-ID: <20220823201937.46855-4-vadimp@nvidia.com> (raw)
In-Reply-To: <20220823201937.46855-1-vadimp@nvidia.com>

Remove redundant 'NULL' check for of if 'data->notifier'.

Replace 'return err' by 'return 0' in mlxreg_lc_probe().

Fixes: 62f9529b8d5c87b ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
 drivers/platform/mellanox/mlxreg-lc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c
index e578c7bc060b..1e0c3ddc46cd 100644
--- a/drivers/platform/mellanox/mlxreg-lc.c
+++ b/drivers/platform/mellanox/mlxreg-lc.c
@@ -825,10 +825,9 @@ static int mlxreg_lc_probe(struct platform_device *pdev)
 
 	mutex_init(&mlxreg_lc->lock);
 	/* Set event notification callback. */
-	if (data->notifier) {
-		data->notifier->user_handler = mlxreg_lc_event_handler;
-		data->notifier->handle = mlxreg_lc;
-	}
+	data->notifier->user_handler = mlxreg_lc_event_handler;
+	data->notifier->handle = mlxreg_lc;
+
 	data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr);
 	if (!data->hpdev.adapter) {
 		dev_err(&pdev->dev, "Failed to get adapter for bus %d\n",
@@ -888,7 +887,7 @@ static int mlxreg_lc_probe(struct platform_device *pdev)
 	if (err)
 		goto mlxreg_lc_config_init_fail;
 
-	return err;
+	return 0;
 
 mlxreg_lc_config_init_fail:
 regcache_sync_fail:
-- 
2.20.1


  parent reply	other threads:[~2022-08-23 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak
2022-08-23 20:19 ` [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning Vadim Pasternak
2022-08-23 20:19 ` [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue Vadim Pasternak
2022-09-01 12:48   ` Hans de Goede
2022-08-23 20:19 ` Vadim Pasternak [this message]
2022-08-23 20:19 ` [PATCH platform 4/4] platform/mellanox: Remove redundant 'NULL' check Vadim Pasternak
2022-09-01 12:46 ` [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Hans de Goede

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=20220823201937.46855-4-vadimp@nvidia.com \
    --to=vadimp@nvidia.com \
    --cc=dan.carpenter@oracle.comq \
    --cc=hdegoede@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).