aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-06-23 16:59:02 +0200
committerJens Axboe <axboe@kernel.dk>2021-06-30 15:34:13 -0600
commitd6da83d072c187d6a69d5a49e2320f62920889d7 (patch)
tree5905f420963664febde5084a52cf4dab20f435e1 /drivers/block
parentloop: reduce loop_ctl_mutex coverage in loop_exit (diff)
downloadlinux-dev-d6da83d072c187d6a69d5a49e2320f62920889d7.tar.xz
linux-dev-d6da83d072c187d6a69d5a49e2320f62920889d7.zip
loop: remove the l argument to loop_add
None of the callers cares about the allocated struct loop_device. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Link: https://lore.kernel.org/r/20210623145908.92973-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/loop.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 4a3712e4cf12..d587ad210ecd 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2237,7 +2237,7 @@ static const struct blk_mq_ops loop_mq_ops = {
.complete = lo_complete_rq,
};
-static int loop_add(struct loop_device **l, int i)
+static int loop_add(int i)
{
struct loop_device *lo;
struct gendisk *disk;
@@ -2326,7 +2326,6 @@ static int loop_add(struct loop_device **l, int i)
disk->queue = lo->lo_queue;
sprintf(disk->disk_name, "loop%d", i);
add_disk(disk);
- *l = lo;
return lo->lo_number;
out_cleanup_tags:
@@ -2396,7 +2395,7 @@ static void loop_probe(dev_t dev)
mutex_lock(&loop_ctl_mutex);
if (loop_lookup(&lo, idx) < 0)
- loop_add(&lo, idx);
+ loop_add(idx);
mutex_unlock(&loop_ctl_mutex);
}
@@ -2418,7 +2417,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
ret = -EEXIST;
break;
}
- ret = loop_add(&lo, parm);
+ ret = loop_add(parm);
break;
case LOOP_CTL_REMOVE:
ret = loop_lookup(&lo, parm);
@@ -2446,7 +2445,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
ret = loop_lookup(&lo, -1);
if (ret >= 0)
break;
- ret = loop_add(&lo, -1);
+ ret = loop_add(-1);
}
mutex_unlock(&loop_ctl_mutex);
@@ -2473,7 +2472,6 @@ MODULE_ALIAS("devname:loop-control");
static int __init loop_init(void)
{
int i, nr;
- struct loop_device *lo;
int err;
part_shift = 0;
@@ -2527,7 +2525,7 @@ static int __init loop_init(void)
/* pre-create number of devices given by config or max_loop */
mutex_lock(&loop_ctl_mutex);
for (i = 0; i < nr; i++)
- loop_add(&lo, i);
+ loop_add(i);
mutex_unlock(&loop_ctl_mutex);
printk(KERN_INFO "loop: module loaded\n");