aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r--drivers/block/xen-blkfront.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index ae00a82f350b..b5cedccb5d7d 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1906,7 +1906,9 @@ static int negotiate_mq(struct blkfront_info *info)
1906 if (!info->nr_rings) 1906 if (!info->nr_rings)
1907 info->nr_rings = 1; 1907 info->nr_rings = 1;
1908 1908
1909 info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL); 1909 info->rinfo = kcalloc(info->nr_rings,
1910 sizeof(struct blkfront_ring_info),
1911 GFP_KERNEL);
1910 if (!info->rinfo) { 1912 if (!info->rinfo) {
1911 xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); 1913 xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure");
1912 return -ENOMEM; 1914 return -ENOMEM;
@@ -2216,15 +2218,18 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
2216 } 2218 }
2217 2219
2218 for (i = 0; i < BLK_RING_SIZE(info); i++) { 2220 for (i = 0; i < BLK_RING_SIZE(info); i++) {
2219 rinfo->shadow[i].grants_used = kzalloc( 2221 rinfo->shadow[i].grants_used =
2220 sizeof(rinfo->shadow[i].grants_used[0]) * grants, 2222 kcalloc(grants,
2221 GFP_NOIO); 2223 sizeof(rinfo->shadow[i].grants_used[0]),
2222 rinfo->shadow[i].sg = kzalloc(sizeof(rinfo->shadow[i].sg[0]) * psegs, GFP_NOIO);
2223 if (info->max_indirect_segments)
2224 rinfo->shadow[i].indirect_grants = kzalloc(
2225 sizeof(rinfo->shadow[i].indirect_grants[0]) *
2226 INDIRECT_GREFS(grants),
2227 GFP_NOIO); 2224 GFP_NOIO);
2225 rinfo->shadow[i].sg = kcalloc(psegs,
2226 sizeof(rinfo->shadow[i].sg[0]),
2227 GFP_NOIO);
2228 if (info->max_indirect_segments)
2229 rinfo->shadow[i].indirect_grants =
2230 kcalloc(INDIRECT_GREFS(grants),
2231 sizeof(rinfo->shadow[i].indirect_grants[0]),
2232 GFP_NOIO);
2228 if ((rinfo->shadow[i].grants_used == NULL) || 2233 if ((rinfo->shadow[i].grants_used == NULL) ||
2229 (rinfo->shadow[i].sg == NULL) || 2234 (rinfo->shadow[i].sg == NULL) ||
2230 (info->max_indirect_segments && 2235 (info->max_indirect_segments &&