From: Libo Chen Date: Thu, 27 Jun 2013 23:51:12 +0000 (+1000) Subject: drivers/cdrom/gdrom.c: fix device number leak X-Git-Tag: next-20130628~3^2~616 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=95ebab7ddee739e249887a0c584e19db63f10b50;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; }