From d6da83d072c187d6a69d5a49e2320f62920889d7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 23 Jun 2021 16:59:02 +0200 Subject: [PATCH] loop: remove the l argument to loop_add None of the callers cares about the allocated struct loop_device. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20210623145908.92973-4-hch@lst.de Signed-off-by: Jens Axboe --- drivers/block/loop.c | 12 +++++------- 1 file 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");