nbd: Remove superfluous casts
authorBart Van Assche <bvanassche@acm.org>
Fri, 10 May 2024 20:23:10 +0000 (13:23 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 14 May 2024 13:22:35 +0000 (07:22 -0600)
In Linux kernel code it is preferred not to use a cast when converting a
void pointer to another pointer type.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Yu Kuai <yukuai3@huawei.com>
Cc: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240510202313.25209-3-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c

index 9d4ec9273bf9545b715aa2aefdb3d8cefaaba9ca..90760f27824df57cd01cf9868c0e28653c10f030 100644 (file)
@@ -222,7 +222,7 @@ static ssize_t pid_show(struct device *dev,
                        struct device_attribute *attr, char *buf)
 {
        struct gendisk *disk = dev_to_disk(dev);
-       struct nbd_device *nbd = (struct nbd_device *)disk->private_data;
+       struct nbd_device *nbd = disk->private_data;
 
        return sprintf(buf, "%d\n", nbd->pid);
 }
@@ -236,7 +236,7 @@ static ssize_t backend_show(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
        struct gendisk *disk = dev_to_disk(dev);
-       struct nbd_device *nbd = (struct nbd_device *)disk->private_data;
+       struct nbd_device *nbd = disk->private_data;
 
        return sprintf(buf, "%s\n", nbd->backend ?: "");
 }