From: Libo Chen Date: Wed, 19 Jun 2013 00:05:43 +0000 (+1000) Subject: drivers/cdrom/gdrom.c: fix device number leak X-Git-Tag: next-20130619~2^2~586 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e693df9f20e4bff98494b409616af28e6eb50625;p=karo-tx-linux.git drivers/cdrom/gdrom.c: fix device number leak Without this patch, gdrom_major will leak when gd.cd_info alloc fails. Signed-off-by: Libo Chen Cc: Jens Axboe Acked-by: Tejun Heo Signed-off-by: Andrew Morton --- diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 4afcb65cc623..5980cb9af857 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -830,9 +830,9 @@ probe_fail_cdrom_register: del_gendisk(gd.disk); probe_fail_no_disk: kfree(gd.cd_info); +probe_fail_no_mem: unregister_blkdev(gdrom_major, GDROM_DEV_NAME); gdrom_major = 0; -probe_fail_no_mem: pr_warning("Probe failed - error is 0x%X\n", err); return err; }