linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: osst: remove useless variable assignments in osst_int_ioctl()
@ 2017-06-27 22:23 Gustavo A. R. Silva
  0 siblings, 0 replies; only message in thread
From: Gustavo A. R. Silva @ 2017-06-27 22:23 UTC (permalink / raw)
  To: Willem Riede, James E.J. Bottomley, Martin K. Petersen
  Cc: osst-users, linux-scsi, linux-kernel, Gustavo A. R. Silva

Value assigned to variable blkno at lines
4123:if (blkno >= 0) blkno += arg; and
4127:if (blkno >= 0) blkno -= arg;
is overwritten at line 4131:blkno  = STps->drv_block;
before it can be used.

This makes such variable assignments useless.

Addresses-Coverity-ID: 1397685
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/scsi/osst.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 929ee7e..a62c1f2 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -4118,14 +4118,11 @@ static int osst_int_ioctl(struct osst_tape * STp, struct osst_request ** aSRpnt,
 		   printk(OSST_DEB_MSG "%s:D: Skipping %lu blocks %s from logical block %d\n",
 				name, arg, cmd_in==MTFSR?"forward":"backward", logical_blk_num);
 #endif
-		if (cmd_in == MTFSR) {
-		   logical_blk_num += arg;
-		   if (blkno >= 0) blkno += arg;
-		}
-		else {
-		   logical_blk_num -= arg;
-		   if (blkno >= 0) blkno -= arg;
-		}
+		if (cmd_in == MTFSR)
+			logical_blk_num += arg;
+		else
+			logical_blk_num -= arg;
+
 		ioctl_result = osst_seek_logical_blk(STp, &SRpnt, logical_blk_num);
 		fileno = STps->drv_file;
 		blkno  = STps->drv_block;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-27 22:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 22:23 [PATCH] scsi: osst: remove useless variable assignments in osst_int_ioctl() Gustavo A. R. Silva

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).