All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pcd: fix error codes in pcd_init_unit()
@ 2021-10-01 12:26 Dan Carpenter
  2021-10-01 19:34 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-10-01 12:26 UTC (permalink / raw)
  To: Tim Waugh, Christoph Hellwig; +Cc: Jens Axboe, linux-block, kernel-janitors

Return -ENODEV on these error paths instead of returning success.

Fixes: ea3d5fcb746a ("pcd: cleanup initialization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/block/paride/pcd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 4cc0d141db78..0214f123d018 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -613,8 +613,7 @@ static int pcd_identify(struct pcd_unit *cd)
 }
 
 /*
- * returns  0, with id set if drive is detected
- *	    -1, if drive detection failed
+ * returns 0, with id set if drive is detected, otherwise an error code.
  */
 static int pcd_probe(struct pcd_unit *cd, int ms)
 {
@@ -627,7 +626,7 @@ static int pcd_probe(struct pcd_unit *cd, int ms)
 		if (!pcd_reset(cd) && !pcd_identify(cd))
 			return 0;
 	}
-	return -1;
+	return -ENODEV;
 }
 
 static int pcd_probe_capabilities(struct pcd_unit *cd)
@@ -933,9 +932,12 @@ static int pcd_init_unit(struct pcd_unit *cd, bool autoprobe, int port,
 	disk->events = DISK_EVENT_MEDIA_CHANGE;
 
 	if (!pi_init(cd->pi, autoprobe, port, mode, unit, protocol, delay,
-			pcd_buffer, PI_PCD, verbose, cd->name))
+			pcd_buffer, PI_PCD, verbose, cd->name)) {
+		ret = -ENODEV;
 		goto out_free_disk;
-	if (pcd_probe(cd, ms))
+	}
+	ret = pcd_probe(cd, ms);
+	if (ret)
 		goto out_pi_release;
 
 	cd->present = 1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pcd: fix error codes in pcd_init_unit()
  2021-10-01 12:26 [PATCH] pcd: fix error codes in pcd_init_unit() Dan Carpenter
@ 2021-10-01 19:34 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-10-01 19:34 UTC (permalink / raw)
  To: Dan Carpenter, Tim Waugh, Christoph Hellwig; +Cc: linux-block, kernel-janitors

On 10/1/21 6:26 AM, Dan Carpenter wrote:
> Return -ENODEV on these error paths instead of returning success.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-01 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 12:26 [PATCH] pcd: fix error codes in pcd_init_unit() Dan Carpenter
2021-10-01 19:34 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.