Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673074

Re: [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment

From "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment
Date 2017-06-22 23:50 +0200
Message-ID <tVi9c-1Mr-5@gated-at.bofh.it> (permalink)
References <tVfXH-uK-11@gated-at.bofh.it> <tVg7p-xW-31@gated-at.bofh.it> <tVhwt-1xP-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Borislav,

Quoting Borislav Petkov <bp@alien8.de>:

> On Thu, Jun 22, 2017 at 02:30:10PM -0500, Gustavo A. R. Silva wrote:
>> Value assigned to variable _ret_ at line 176 is overwritten
>> a few lines below before it can be used. This makes such
>> variable assignment useless.
>>
>> Addresses-Coverity-ID: 1403730
>
> Get rid of this tag...
>
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>>  drivers/edac/pnd2_edac.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
>> index c51ec73..d1de53e 100644
>> --- a/drivers/edac/pnd2_edac.c
>> +++ b/drivers/edac/pnd2_edac.c
>> @@ -173,7 +173,7 @@ static int apl_rd_reg(int port, int off, int  
>> op, void *data, size_t sz, char *na
>>  	edac_dbg(2, "Read %s port=%x off=%x op=%x\n", name, port, off, op);
>>  	switch (sz) {
>>  	case 8:
>> -		ret = sbi_send(port, off + 4, op, (u32 *)(data + 4));
>> +		sbi_send(port, off + 4, op, (u32 *)(data + 4));
>
> ... keep ret but OR it in with its previous value:
>
>         case 8:
>                 ret  = sbi_send(port, off + 4, op, (u32 *)(data + 4));
> 		/* fall through */
>         case 4:
>                 ret |= sbi_send(port, off, op, (u32 *)data);
>
>>  		/* fall through */
>>  	case 4:
>>  		ret = sbi_send(port, off, op, (u32 *)data);
>
> ... and merge both into a single patch.
>

I got it. I'll send a new patch shortly.

Thanks!
--
Gustavo A. R. Silva

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] edac: pnd2_edac: add code comment for clarification "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-22 21:30 +0200
  [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-22 21:40 +0200
    Re: [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment Borislav Petkov <bp@alien8.de> - 2017-06-22 23:10 +0200
      Re: [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-22 23:50 +0200
        [PATCH] edac: pnd2_edac: add code comment for clarification and  update variable assignment "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-23 00:10 +0200
          Re: [PATCH] edac: pnd2_edac: add code comment for clarification and  update variable assignment Borislav Petkov <bp@alien8.de> - 2017-06-23 10:00 +0200

csiph-web