From: Bob Liu Date: Wed, 27 Jul 2016 09:42:04 +0000 (+0800) Subject: xen-blkfront: free resources if xlvbd_alloc_gendisk fails X-Git-Tag: v4.14-rc1~2591^2~10^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e876c2bd37fbb5c37a4554a79cf979d486f0e82;p=platform%2Fkernel%2Flinux-rpi.git xen-blkfront: free resources if xlvbd_alloc_gendisk fails Current code forgets to free resources in the failure path of xlvbd_alloc_gendisk(), this patch fix it. Signed-off-by: Bob Liu Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index f84e220..88ef6d4 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -2442,7 +2442,7 @@ static void blkfront_connect(struct blkfront_info *info) if (err) { xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", info->xbdev->otherend); - return; + goto fail; } xenbus_switch_state(info->xbdev, XenbusStateConnected); @@ -2455,6 +2455,11 @@ static void blkfront_connect(struct blkfront_info *info) device_add_disk(&info->xbdev->dev, info->gd); info->is_ready = 1; + return; + +fail: + blkif_free(info, 0); + return; } /**