2014-06-25 14:00:53

by Rickard Strandqvist

[permalink] [raw]
Subject: [PATCH] scsi: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once

A struct member variable is set to different values without having used in between.

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <[email protected]>
---
drivers/scsi/pm8001/pm80xx_hwi.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index d70587f..2698227 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -249,7 +249,6 @@ moreData:
sprintf(pm8001_ha->
forensic_info.data_buf.direct_data,
"%08x ", 4);
- pm8001_ha->forensic_info.data_buf.read_len = 0xFFFFFFFF;
pm8001_ha->forensic_info.data_buf.direct_len = 0;
pm8001_ha->forensic_info.data_buf.direct_offset = 0;
pm8001_ha->forensic_info.data_buf.read_len = 0;
--
1.7.10.4


2014-06-25 15:35:18

by Maurizio Lombardi

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once

This one looks good to me,

Reviewed-by: Maurizio Lombardi <[email protected]>

On 06/25/2014 04:01 PM, Rickard Strandqvist wrote:
> A struct member variable is set to different values without having used in between.
>
> This was found using a static code analysis program called cppcheck
>
> Signed-off-by: Rickard Strandqvist <[email protected]>
> ---
> drivers/scsi/pm8001/pm80xx_hwi.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index d70587f..2698227 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -249,7 +249,6 @@ moreData:
> sprintf(pm8001_ha->
> forensic_info.data_buf.direct_data,
> "%08x ", 4);
> - pm8001_ha->forensic_info.data_buf.read_len = 0xFFFFFFFF;
> pm8001_ha->forensic_info.data_buf.direct_len = 0;
> pm8001_ha->forensic_info.data_buf.direct_offset = 0;
> pm8001_ha->forensic_info.data_buf.read_len = 0;
>

2014-06-26 08:09:31

by Jack Wang

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once

Thanks Rickard,

>From my point of view, looks good, but I'd like to get review from Anand
(cc-ed).

Anand, could you share your opinion?

Regards,
Jack

On 06/25/2014 04:01 PM, Rickard Strandqvist wrote:
> A struct member variable is set to different values without having used in between.
>
> This was found using a static code analysis program called cppcheck
>
> Signed-off-by: Rickard Strandqvist <[email protected]>
> ---
> drivers/scsi/pm8001/pm80xx_hwi.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index d70587f..2698227 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -249,7 +249,6 @@ moreData:
> sprintf(pm8001_ha->
> forensic_info.data_buf.direct_data,
> "%08x ", 4);
> - pm8001_ha->forensic_info.data_buf.read_len = 0xFFFFFFFF;
> pm8001_ha->forensic_info.data_buf.direct_len = 0;
> pm8001_ha->forensic_info.data_buf.direct_offset = 0;
> pm8001_ha->forensic_info.data_buf.read_len = 0;
>

2014-06-26 08:20:44

by Maurizio Lombardi

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once

On 06/26/2014 10:09 AM, Jack Wang wrote:
> Thanks Rickard,
>
> From my point of view, looks good, but I'd like to get review from Anand
> (cc-ed).

I would like to add that I noticed that this fields is only set and appears to be never used,
maybe it could be completely removed.

Regards,
Maurizio Lombardi

2014-06-27 09:31:25

by Suresh Thiagarajan

[permalink] [raw]
Subject: RE: [PATCH] scsi: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once



On Thu, Jun 26, 2014 at 1:50 PM, Maurizio Lombardi <[email protected]> wrote:
> On 06/26/2014 10:09 AM, Jack Wang wrote:
>> Thanks Rickard,
>>
>> From my point of view, looks good, but I'd like to get review from Anand
>> (cc-ed).
>
> I would like to add that I noticed that this fields is only set and appears to be never used,
> maybe it could be completely removed.

You are correct. The whole forensic_info structure itself is not used or referred anywhere. I will remove it and send a patch.

Regards,
Suresh Thiagarajan
>
> Regards,
> Maurizio Lombardi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html