Skip to content

Commit 605cdf0

Browse files
tititiou36axboe
authored andcommitted
gdrom: Add missing error code
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 8c87fe7 commit 605cdf0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/cdrom/gdrom.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,16 +807,20 @@ static int probe_gdrom(struct platform_device *devptr)
807807
if (err)
808808
goto probe_fail_cmdirq_register;
809809
gd.gdrom_rq = blk_init_queue(gdrom_request, &gdrom_lock);
810-
if (!gd.gdrom_rq)
810+
if (!gd.gdrom_rq) {
811+
err = -ENOMEM;
811812
goto probe_fail_requestq;
813+
}
812814

813815
err = probe_gdrom_setupqueue();
814816
if (err)
815817
goto probe_fail_toc;
816818

817819
gd.toc = kzalloc(sizeof(struct gdromtoc), GFP_KERNEL);
818-
if (!gd.toc)
820+
if (!gd.toc) {
821+
err = -ENOMEM;
819822
goto probe_fail_toc;
823+
}
820824
add_disk(gd.disk);
821825
return 0;
822826

0 commit comments

Comments
 (0)