linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gdrom: Add missing error code
@ 2017-02-06 22:00 Christophe JAILLET
  2017-02-07 19:39 ` Christoph Hellwig
  2017-02-07 23:17 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2017-02-06 22:00 UTC (permalink / raw)
  To: hch, axboe; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET

In case of error, 'err' is known to be 0 here, because of the previous
test. Set it to a -ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/cdrom/gdrom.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index b6f1a5d95bc5..bc316d288f65 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -808,16 +808,20 @@ static int probe_gdrom(struct platform_device *devptr)
 	if (err)
 		goto probe_fail_cmdirq_register;
 	gd.gdrom_rq = blk_init_queue(gdrom_request, &gdrom_lock);
-	if (!gd.gdrom_rq)
+	if (!gd.gdrom_rq) {
+		err = -ENOMEM;
 		goto probe_fail_requestq;
+	}
 
 	err = probe_gdrom_setupqueue();
 	if (err)
 		goto probe_fail_toc;
 
 	gd.toc = kzalloc(sizeof(struct gdromtoc), GFP_KERNEL);
-	if (!gd.toc)
+	if (!gd.toc) {
+		err = -ENOMEM;
 		goto probe_fail_toc;
+	}
 	add_disk(gd.disk);
 	return 0;
 
-- 
2.9.3

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

* Re: [PATCH] gdrom: Add missing error code
  2017-02-06 22:00 [PATCH] gdrom: Add missing error code Christophe JAILLET
@ 2017-02-07 19:39 ` Christoph Hellwig
  2017-02-07 23:17 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-02-07 19:39 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: hch, axboe, linux-kernel, kernel-janitors

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] gdrom: Add missing error code
  2017-02-06 22:00 [PATCH] gdrom: Add missing error code Christophe JAILLET
  2017-02-07 19:39 ` Christoph Hellwig
@ 2017-02-07 23:17 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-02-07 23:17 UTC (permalink / raw)
  To: Christophe JAILLET, hch; +Cc: linux-kernel, kernel-janitors

On 02/06/2017 03:00 PM, Christophe JAILLET wrote:
> In case of error, 'err' is known to be 0 here, because of the previous
> test. Set it to a -ENOMEM instead.

Added for 4.11, thanks.

-- 
Jens Axboe

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

end of thread, other threads:[~2017-02-08  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 22:00 [PATCH] gdrom: Add missing error code Christophe JAILLET
2017-02-07 19:39 ` Christoph Hellwig
2017-02-07 23:17 ` Jens Axboe

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).