linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] loop: remove redundant assignment to variable error
@ 2020-05-24 16:10 Colin King
  2020-05-24 16:44 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-05-24 16:10 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable error is being assigned a value that is never
read so the assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/block/loop.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index c20d01c08e5c..060da16b3743 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1136,8 +1136,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
 	if (error)
 		goto out_unlock;
 
-	error = 0;
-
 	set_device_ro(bdev, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
 
 	lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] loop: remove redundant assignment to variable error
  2020-05-24 16:10 [PATCH][next] loop: remove redundant assignment to variable error Colin King
@ 2020-05-24 16:44 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-05-24 16:44 UTC (permalink / raw)
  To: Colin King, linux-block; +Cc: kernel-janitors, linux-kernel

On 5/24/20 10:10 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable error is being assigned a value that is never
> read so the assignment is redundant and can be removed.

Plus, by definition, we already know that error is zero at the
time of assignment.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-24 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24 16:10 [PATCH][next] loop: remove redundant assignment to variable error Colin King
2020-05-24 16:44 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).