Instead of storing the return values into the err variable just return the err from switch cases, since we don't do anything after switch with that error but return. This also removes the need for the local variable err in lo_compat_ioctl(). No functional change in this patch. Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx> --- drivers/block/loop.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index b8028c6d5ecc..d9cd0ac3d947 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1838,17 +1838,14 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct loop_device *lo = bdev->bd_disk->private_data; - int err; switch(cmd) { case LOOP_SET_STATUS: - err = loop_set_status_compat(lo, - (const struct compat_loop_info __user *)arg); - break; + return loop_set_status_compat(lo, + (const struct compat_loop_info __user *)arg); case LOOP_GET_STATUS: - err = loop_get_status_compat(lo, - (struct compat_loop_info __user *)arg); - break; + return loop_get_status_compat(lo, + (struct compat_loop_info __user *)arg); case LOOP_SET_CAPACITY: case LOOP_CLR_FD: case LOOP_GET_STATUS64: @@ -1860,13 +1857,10 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode, case LOOP_CHANGE_FD: case LOOP_SET_BLOCK_SIZE: case LOOP_SET_DIRECT_IO: - err = lo_ioctl(bdev, mode, cmd, arg); - break; + return lo_ioctl(bdev, mode, cmd, arg); default: - err = -ENOIOCTLCMD; - break; + return -ENOIOCTLCMD; } - return err; } #endif -- 2.22.1