Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1643721 > unrolled thread
| Started by | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
|---|---|
| First post | 2017-05-18 02:40 +0200 |
| Last post | 2017-05-18 19:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] scsi: remove useless variable assignment "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-05-18 02:40 +0200
Re: [PATCH] scsi: remove useless variable assignment James Bottomley <jejb@linux.vnet.ibm.com> - 2017-05-18 06:50 +0200
Re: [PATCH] scsi: remove useless variable assignment "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-05-18 19:50 +0200
| From | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
|---|---|
| Date | 2017-05-18 02:40 +0200 |
| Subject | [PATCH] scsi: remove useless variable assignment |
| Message-ID | <tIhDX-1Ui-5@gated-at.bofh.it> |
Remove this assignment once the value stored in variable _k_ is overwritten after a few lines. Addresses-Coverity-ID: 1226927 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> --- drivers/scsi/qlogicfas408.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c index c3a9151..269440a 100644 --- a/drivers/scsi/qlogicfas408.c +++ b/drivers/scsi/qlogicfas408.c @@ -329,7 +329,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd) */ if ((k = ql_wai(priv))) return (k << 16); - k = inb(qbase + 5); /* should be 0x10, bus service */ } /* -- 2.5.0
[toc] | [next] | [standalone]
| From | James Bottomley <jejb@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-05-18 06:50 +0200 |
| Message-ID | <tIlxT-4UV-13@gated-at.bofh.it> |
| In reply to | #1643721 |
On Wed, 2017-05-17 at 19:30 -0500, Gustavo A. R. Silva wrote: > Remove this assignment once the value stored in variable _k_ is > overwritten after a few lines. > > Addresses-Coverity-ID: 1226927 > Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> > --- > drivers/scsi/qlogicfas408.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/scsi/qlogicfas408.c > b/drivers/scsi/qlogicfas408.c > index c3a9151..269440a 100644 > --- a/drivers/scsi/qlogicfas408.c > +++ b/drivers/scsi/qlogicfas408.c > @@ -329,7 +329,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd > *cmd) > */ > if ((k = ql_wai(priv))) > return (k << 16); > - k = inb(qbase + 5); /* should be 0x10, bus > service */ That doesn't look right to me. inb() is a statement which has an effect on the I/O device regardless of whether the returned value is used or discarded. In this case I think it's being used to clear pending interrupts, so removing it will likely cause a phase error. James
[toc] | [prev] | [next] | [standalone]
| From | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
|---|---|
| Date | 2017-05-18 19:50 +0200 |
| Message-ID | <tIxIK-5Uz-15@gated-at.bofh.it> |
| In reply to | #1643812 |
Hi James,
Quoting James Bottomley <jejb@linux.vnet.ibm.com>:
> On Wed, 2017-05-17 at 19:30 -0500, Gustavo A. R. Silva wrote:
>> Remove this assignment once the value stored in variable _k_ is
>> overwritten after a few lines.
>>
>> Addresses-Coverity-ID: 1226927
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>> drivers/scsi/qlogicfas408.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/scsi/qlogicfas408.c
>> b/drivers/scsi/qlogicfas408.c
>> index c3a9151..269440a 100644
>> --- a/drivers/scsi/qlogicfas408.c
>> +++ b/drivers/scsi/qlogicfas408.c
>> @@ -329,7 +329,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd
>> *cmd)
>> */
>> if ((k = ql_wai(priv)))
>> return (k << 16);
>> - k = inb(qbase + 5); /* should be 0x10, bus
>> service */
>
> That doesn't look right to me. inb() is a statement which has an
> effect on the I/O device regardless of whether the returned value is
> used or discarded. In this case I think it's being used to clear
> pending interrupts, so removing it will likely cause a phase error.
>
You are right, I get it.
In this case I think a patch to ignore the return value could be applied:
index c3a9151..8f5339a 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -329,7 +329,7 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
*/
if ((k = ql_wai(priv)))
return (k << 16);
- k = inb(qbase + 5); /* should be 0x10, bus service */
+ inb(qbase + 5); /* should be 0x10, bus service */
}
What do you think?
Thank you for the clarification.
--
Gustavo A. R. Silva
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web