diff mbox series

[v2,21/29] scsi: aic7xxx: aic7xxx_osm: Fix 'amount_xferred' set but not used issue

Message ID 20200713074645.126138-22-lee.jones@linaro.org
State Superseded
Headers show
Series Fix a bunch more SCSI related W=1 warnings | expand

Commit Message

Lee Jones July 13, 2020, 7:46 a.m. UTC
'amount_xferred' is used, but only in certain circumstances.  Place
the same stipulations on the defining/allocating of 'amount_xferred'
as is placed when using it.

We've been careful not to change any of the ordering semantics here.

Fixes the following W=1 kernel build warning(s):

 drivers/scsi/aic7xxx/aic7xxx_osm.c: In function ‘ahc_done’:
 drivers/scsi/aic7xxx/aic7xxx_osm.c:1725:12: warning: variable ‘amount_xferred’ set but not used [-Wunused-but-set-variable]
 1725 | uint32_t amount_xferred;
 | ^~~~~~~~~~~~~~

Cc: Hannes Reinecke <hare@suse.com>
Cc: "Daniel M. Eischen" <deischen@iworks.InterWorks.org>
Cc: Doug Ledford <dledford@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.25.1

Comments

Hannes Reinecke July 14, 2020, 7:08 a.m. UTC | #1
On 7/13/20 9:46 AM, Lee Jones wrote:
> 'amount_xferred' is used, but only in certain circumstances.  Place

> the same stipulations on the defining/allocating of 'amount_xferred'

> as is placed when using it.

> 

> We've been careful not to change any of the ordering semantics here.

> 

> Fixes the following W=1 kernel build warning(s):

> 

>   drivers/scsi/aic7xxx/aic7xxx_osm.c: In function ‘ahc_done’:

>   drivers/scsi/aic7xxx/aic7xxx_osm.c:1725:12: warning: variable ‘amount_xferred’ set but not used [-Wunused-but-set-variable]

>   1725 | uint32_t amount_xferred;

>   | ^~~~~~~~~~~~~~

> 

> Cc: Hannes Reinecke <hare@suse.com>

> Cc: "Daniel M. Eischen" <deischen@iworks.InterWorks.org>

> Cc: Doug Ledford <dledford@redhat.com>

> Signed-off-by: Lee Jones <lee.jones@linaro.org>

> ---

>   drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 ++

>   1 file changed, 2 insertions(+)

> 

> diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c

> index ed437c16de881..e7ccb8b80fc19 100644

> --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c

> +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c

> @@ -1711,10 +1711,12 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)

>   	 */

>   	cmd->sense_buffer[0] = 0;

>   	if (ahc_get_transaction_status(scb) == CAM_REQ_INPROG) {

> +#ifdef AHC_REPORT_UNDERFLOWS

>   		uint32_t amount_xferred;

>   

>   		amount_xferred =

>   		    ahc_get_transfer_length(scb) - ahc_get_residual(scb);

> +#endif

>   		if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) {

>   #ifdef AHC_DEBUG

>   			if ((ahc_debug & AHC_SHOW_MISC) != 0) {

> 

Reviewed-by: Hannes Reinecke <hare@suse.de>


Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
diff mbox series

Patch

diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index ed437c16de881..e7ccb8b80fc19 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1711,10 +1711,12 @@  ahc_done(struct ahc_softc *ahc, struct scb *scb)
 	 */
 	cmd->sense_buffer[0] = 0;
 	if (ahc_get_transaction_status(scb) == CAM_REQ_INPROG) {
+#ifdef AHC_REPORT_UNDERFLOWS
 		uint32_t amount_xferred;
 
 		amount_xferred =
 		    ahc_get_transfer_length(scb) - ahc_get_residual(scb);
+#endif
 		if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) {
 #ifdef AHC_DEBUG
 			if ((ahc_debug & AHC_SHOW_MISC) != 0) {