2020-07-13 08:01:42

by Lee Jones

[permalink] [raw]
Subject: [PATCH v2 23/24] scsi: aic7xxx: aic79xx_osm: Fix 'amount_xferred' set but not used issue

'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/aic79xx_osm.c: In function ‘ahd_done’:
drivers/scsi/aic7xxx/aic79xx_osm.c:1796:12: warning: variable ‘amount_xferred’ set but not used [-Wunused-but-set-variable]

Cc: Hannes Reinecke <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
---
drivers/scsi/aic7xxx/aic79xx_osm.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 8e43ff86e0a60..3782a20d58885 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1787,10 +1787,12 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
*/
cmd->sense_buffer[0] = 0;
if (ahd_get_transaction_status(scb) == CAM_REQ_INPROG) {
+#ifdef AHD_REPORT_UNDERFLOWS
uint32_t amount_xferred;

amount_xferred =
ahd_get_transfer_length(scb) - ahd_get_residual(scb);
+#endif
if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) {
#ifdef AHD_DEBUG
if ((ahd_debug & AHD_SHOW_MISC) != 0) {
--
2.25.1


2020-07-14 07:47:50

by Hannes Reinecke

[permalink] [raw]
Subject: Re: [PATCH v2 23/24] scsi: aic7xxx: aic79xx_osm: Fix 'amount_xferred' set but not used issue

On 7/13/20 10:00 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/aic79xx_osm.c: In function ‘ahd_done’:
> drivers/scsi/aic7xxx/aic79xx_osm.c:1796:12: warning: variable ‘amount_xferred’ set but not used [-Wunused-but-set-variable]
>
> Cc: Hannes Reinecke <[email protected]>
> Signed-off-by: Lee Jones <[email protected]>
> ---
> drivers/scsi/aic7xxx/aic79xx_osm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
> index 8e43ff86e0a60..3782a20d58885 100644
> --- a/drivers/scsi/aic7xxx/aic79xx_osm.c
> +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
> @@ -1787,10 +1787,12 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
> */
> cmd->sense_buffer[0] = 0;
> if (ahd_get_transaction_status(scb) == CAM_REQ_INPROG) {
> +#ifdef AHD_REPORT_UNDERFLOWS
> uint32_t amount_xferred;
>
> amount_xferred =
> ahd_get_transfer_length(scb) - ahd_get_residual(scb);
> +#endif
> if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) {
> #ifdef AHD_DEBUG
> if ((ahd_debug & AHD_SHOW_MISC) != 0) {
>
Reviewed-by: Hannes Reinecke <[email protected]>

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
[email protected] +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer