Skip to contentSkip to conversation

aio: remove redundant assignment to variable ret

PATCH In review Colin King 2 participants 2 messages Aug 22, 2019

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 aio: remove redundant assignment to variable ret

From: Colin Ian King <[email protected]>

The variable ret is being set to -EINVAL however this is never read and later it is being reassigned to a new value. The assignment is redundant and hence can be removed.

Addresses-Coverity: ("Unused Value")

---
 fs/aio.c | 1 -
 1 file changed, 1 deletion(-)
fs/aio.c +0 -1
index f9f441b59966..3e290dfac10a 100644
@@ -1528,7 +1528,6 @@ static int aio_read(struct kiocb *req, const struct iocb *iocb,
 	file = req->ki_filp;
 	if (unlikely(!(file->f_mode & FMODE_READ)))
 		return -EBADF;
-	ret = -EINVAL;
 	if (unlikely(!file->f_op->read_iter))
 		return -EINVAL;
 
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Colin King

From: Colin Ian King <[email protected]>

The variable ret is being set to -EINVAL however this is never read and later it is being reassigned to a new value. The assignment is redundant and hence can be removed.

Addresses-Coverity: ("Unused Value")

---
 fs/aio.c | 1 -
 1 file changed, 1 deletion(-)
fs/aio.c +0 -0
index f9f441b59966..3e290dfac10a 100644

fs/aio.c static int aio_read(struct kiocb *req, const struct iocb *iocb, · line 1532

Quoted 6 lines
fs/aio.c +0 -1
@@ -1528,7 +1528,6 @@ static int aio_read(struct kiocb *req, const struct iocb *iocb,
 	file = req->ki_filp;
 	if (unlikely(!(file->f_mode & FMODE_READ)))
 		return -EBADF;
-	ret = -EINVAL;
 	if (unlikely(!file->f_op->read_iter))
 		return -EINVAL;