public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
From: mhkelley58@gmail.com
To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, gregkh@linuxfoundation.org,
	vkuznets@redhat.com
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] Drivers: hv: util: Don't force error code to ENODEV in util_probe()
Date: Wed,  6 Nov 2024 07:42:46 -0800	[thread overview]
Message-ID: <20241106154247.2271-2-mhklinux@outlook.com> (raw)
In-Reply-To: <20241106154247.2271-1-mhklinux@outlook.com>

From: Michael Kelley <mhklinux@outlook.com>

If the util_init function call in util_probe() returns an error code,
util_probe() always return ENODEV, and the error code from the util_init
function is lost. The error message output in the caller, vmbus_probe(),
doesn't show the real error code.

Fix this by just returning the error code from the util_init function.
There doesn't seem to be a reason to force ENODEV, as other errors
such as ENOMEM can already be returned from util_probe(). And the
code in call_driver_probe() implies that ENODEV should mean that a
matching driver wasn't found, which is not the case here.

Suggested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Michael Kelley <mhklinux@outlook.com>
---
Changes in v2: None. This is the first version of Patch 1 of this series.
The "v2" is due to changes to Patch 2 of the series.

 drivers/hv/hv_util.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index c4f525325790..370722220134 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -590,10 +590,8 @@ static int util_probe(struct hv_device *dev,
 	srv->channel = dev->channel;
 	if (srv->util_init) {
 		ret = srv->util_init(srv);
-		if (ret) {
-			ret = -ENODEV;
+		if (ret)
 			goto error1;
-		}
 	}
 
 	/*
-- 
2.25.1


  reply	other threads:[~2024-11-06 15:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 15:42 [PATCH v2 0/2] Drivers: hv: util: Two fixes in util_probe() mhkelley58
2024-11-06 15:42 ` mhkelley58 [this message]
2024-12-08 17:30   ` [PATCH v2 1/2] Drivers: hv: util: Don't force error code to ENODEV " Saurabh Singh Sengar
2024-12-08 23:12     ` Michael Kelley
2024-12-09 17:30       ` Saurabh Singh Sengar
2024-11-06 15:42 ` [PATCH v2 2/2] Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet mhkelley58
2024-12-06  2:44 ` [PATCH v2 0/2] Drivers: hv: util: Two fixes in util_probe() Michael Kelley
2024-12-07  7:02 ` Wei Liu
2024-12-07  7:54   ` Wei Liu

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=20241106154247.2271-2-mhklinux@outlook.com \
    --to=mhkelley58@gmail.com \
    --cc=decui@microsoft.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@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