All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: rts5208: remove redundant retval status check
@ 2017-02-02 12:12 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-02-02 12:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wayne Porter, Amitoj Kaur Chawla,
	Lars-Peter Clausen, Sergio Paracuellos, Bhaktipriya Shridhar,
	Quentin Lambert, Dilek Uzulmez, Jonas Rickert, MingChia Chung,
	devel
  Cc: kernel-janitors, linux-kernel

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

The retval status checks in the proceeding do loop return out
of function ms_read_attritbute_info if there is an error
condition,  thus we never reach the end of the loop with
retval failed status.  Therefore, the retval status check
at end of the do loop is redundant and can be removed.

Detected with CoverityScan, CID#143000 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/rts5208/ms.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 28d56c5..806c121 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -1108,12 +1108,6 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
 		i++;
 	} while (i < 1024);
 
-	if (retval != STATUS_SUCCESS) {
-		kfree(buf);
-		rtsx_trace(chip);
-		return STATUS_FAIL;
-	}
-
 	if ((buf[0] != 0xa5) && (buf[1] != 0xc3)) {
 		/* Signature code is wrong */
 		kfree(buf);
-- 
2.10.2

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

* [PATCH 1/2] staging: rts5208: remove redundant retval status check
@ 2017-02-02 12:12 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-02-02 12:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wayne Porter, Amitoj Kaur Chawla,
	Lars-Peter Clausen, Sergio Paracuellos, Bhaktipriya Shridhar,
	Quentin Lambert, Dilek Uzulmez, Jonas Rickert, MingChia Chung,
	devel
  Cc: kernel-janitors, linux-kernel

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

The retval status checks in the proceeding do loop return out
of function ms_read_attritbute_info if there is an error
condition,  thus we never reach the end of the loop with
retval failed status.  Therefore, the retval status check
at end of the do loop is redundant and can be removed.

Detected with CoverityScan, CID#143000 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/rts5208/ms.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 28d56c5..806c121 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -1108,12 +1108,6 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
 		i++;
 	} while (i < 1024);
 
-	if (retval != STATUS_SUCCESS) {
-		kfree(buf);
-		rtsx_trace(chip);
-		return STATUS_FAIL;
-	}
-
 	if ((buf[0] != 0xa5) && (buf[1] != 0xc3)) {
 		/* Signature code is wrong */
 		kfree(buf);
-- 
2.10.2


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

* [PATCH 2/2] staging: rts5208: remove unncessary result set and check, just return SUCCESS
  2017-02-02 12:12 ` Colin King
@ 2017-02-02 12:12   ` Colin King
  -1 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-02-02 12:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wayne Porter, Amitoj Kaur Chawla,
	Lars-Peter Clausen, Sergio Paracuellos, Bhaktipriya Shridhar,
	Quentin Lambert, Dilek Uzulmez, Jonas Rickert, MingChia Chung,
	devel
  Cc: kernel-janitors, linux-kernel

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

Minor clean up, there is no need to assign result to zero, then
check if it is less than zero. Just return SUCCESS.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/rts5208/rtsx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 68d75d0..b8177f5 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -198,23 +198,21 @@ static int command_abort(struct scsi_cmnd *srb)
  */
 static int device_reset(struct scsi_cmnd *srb)
 {
-	int result = 0;
 	struct rtsx_dev *dev = host_to_rtsx(srb->device->host);
 
 	dev_info(&dev->pci->dev, "%s called\n", __func__);
 
-	return result < 0 ? FAILED : SUCCESS;
+	return SUCCESS;
 }
 
 /* Simulate a SCSI bus reset by resetting the device's USB port. */
 static int bus_reset(struct scsi_cmnd *srb)
 {
-	int result = 0;
 	struct rtsx_dev *dev = host_to_rtsx(srb->device->host);
 
 	dev_info(&dev->pci->dev, "%s called\n", __func__);
 
-	return result < 0 ? FAILED : SUCCESS;
+	return SUCCESS;
 }
 
 /*
-- 
2.10.2

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

* [PATCH 2/2] staging: rts5208: remove unncessary result set and check, just return SUCCESS
@ 2017-02-02 12:12   ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-02-02 12:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wayne Porter, Amitoj Kaur Chawla,
	Lars-Peter Clausen, Sergio Paracuellos, Bhaktipriya Shridhar,
	Quentin Lambert, Dilek Uzulmez, Jonas Rickert, MingChia Chung,
	devel
  Cc: kernel-janitors, linux-kernel

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

Minor clean up, there is no need to assign result to zero, then
check if it is less than zero. Just return SUCCESS.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/rts5208/rtsx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 68d75d0..b8177f5 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -198,23 +198,21 @@ static int command_abort(struct scsi_cmnd *srb)
  */
 static int device_reset(struct scsi_cmnd *srb)
 {
-	int result = 0;
 	struct rtsx_dev *dev = host_to_rtsx(srb->device->host);
 
 	dev_info(&dev->pci->dev, "%s called\n", __func__);
 
-	return result < 0 ? FAILED : SUCCESS;
+	return SUCCESS;
 }
 
 /* Simulate a SCSI bus reset by resetting the device's USB port. */
 static int bus_reset(struct scsi_cmnd *srb)
 {
-	int result = 0;
 	struct rtsx_dev *dev = host_to_rtsx(srb->device->host);
 
 	dev_info(&dev->pci->dev, "%s called\n", __func__);
 
-	return result < 0 ? FAILED : SUCCESS;
+	return SUCCESS;
 }
 
 /*
-- 
2.10.2


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

end of thread, other threads:[~2017-02-02 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-02 12:12 [PATCH 1/2] staging: rts5208: remove redundant retval status check Colin King
2017-02-02 12:12 ` Colin King
2017-02-02 12:12 ` [PATCH 2/2] staging: rts5208: remove unncessary result set and check, just return SUCCESS Colin King
2017-02-02 12:12   ` Colin King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.