* [2/2] edac: pnd2_edac: remove useless variable assignment
2017-06-22 19:26 ` [PATCH 1/2] " Gustavo A. R. Silva
@ 2017-06-22 19:30 ` Gustavo A. R. Silva
-1 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 19:30 UTC (permalink / raw)
To: Tony Luck, Borislav Petkov, Mauro Carvalho Chehab
Cc: linux-edac, linux-kernel, Gustavo A. R. Silva
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
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));
/* fall through */
case 4:
ret = sbi_send(port, off, op, (u32 *)data);
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment
@ 2017-06-22 19:30 ` Gustavo A. R. Silva
0 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 19:30 UTC (permalink / raw)
To: Tony Luck, Borislav Petkov, Mauro Carvalho Chehab
Cc: linux-edac, linux-kernel, Gustavo A. R. Silva
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
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));
/* fall through */
case 4:
ret = sbi_send(port, off, op, (u32 *)data);
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* edac: pnd2_edac: add code comment for clarification and update variable assignment
2017-06-22 22:05 ` [PATCH] " Gustavo A. R. Silva
@ 2017-06-23 7:53 ` Borislav Petkov
-1 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2017-06-23 7:53 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Tony Luck, Mauro Carvalho Chehab, Qiuxu Zhuo, linux-edac,
linux-kernel
On Thu, Jun 22, 2017 at 05:05:35PM -0500, Gustavo A. R. Silva wrote:
> Add code comment to make it clear that the fall-through is intentional and,
> OR ret with its previous value to avoid overwriting it.
>
> Cc: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> drivers/edac/pnd2_edac.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] edac: pnd2_edac: add code comment for clarification and update variable assignment
@ 2017-06-23 7:53 ` Borislav Petkov
0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2017-06-23 7:53 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Tony Luck, Mauro Carvalho Chehab, Qiuxu Zhuo, linux-edac,
linux-kernel
On Thu, Jun 22, 2017 at 05:05:35PM -0500, Gustavo A. R. Silva wrote:
> Add code comment to make it clear that the fall-through is intentional and,
> OR ret with its previous value to avoid overwriting it.
>
> Cc: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> drivers/edac/pnd2_edac.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied, thanks.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 12+ messages in thread
* edac: pnd2_edac: add code comment for clarification and update variable assignment
2017-06-22 21:43 ` [PATCH 2/2] " Gustavo A. R. Silva
@ 2017-06-22 22:05 ` Gustavo A. R. Silva
-1 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 22:05 UTC (permalink / raw)
To: Borislav Petkov, Tony Luck, Mauro Carvalho Chehab, Qiuxu Zhuo
Cc: linux-edac, linux-kernel, Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional and,
OR ret with its previous value to avoid overwriting it.
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/edac/pnd2_edac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 1cad5a9..63cb323 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -174,8 +174,9 @@ static int apl_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
switch (sz) {
case 8:
ret = sbi_send(port, off + 4, op, (u32 *)(data + 4));
+ /* fall through */
case 4:
- ret = sbi_send(port, off, op, (u32 *)data);
+ ret |= sbi_send(port, off, op, (u32 *)data);
pnd2_printk(KERN_DEBUG, "%s=%x%08x ret=%d\n", name,
sz == 8 ? *((u32 *)(data + 4)) : 0, *((u32 *)data), ret);
break;
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH] edac: pnd2_edac: add code comment for clarification and update variable assignment
@ 2017-06-22 22:05 ` Gustavo A. R. Silva
0 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 22:05 UTC (permalink / raw)
To: Borislav Petkov, Tony Luck, Mauro Carvalho Chehab, Qiuxu Zhuo
Cc: linux-edac, linux-kernel, Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional and,
OR ret with its previous value to avoid overwriting it.
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/edac/pnd2_edac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 1cad5a9..63cb323 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -174,8 +174,9 @@ static int apl_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
switch (sz) {
case 8:
ret = sbi_send(port, off + 4, op, (u32 *)(data + 4));
+ /* fall through */
case 4:
- ret = sbi_send(port, off, op, (u32 *)data);
+ ret |= sbi_send(port, off, op, (u32 *)data);
pnd2_printk(KERN_DEBUG, "%s=%x%08x ret=%d\n", name,
sz == 8 ? *((u32 *)(data + 4)) : 0, *((u32 *)data), ret);
break;
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [2/2] edac: pnd2_edac: remove useless variable assignment
2017-06-22 21:07 ` [PATCH 2/2] " Borislav Petkov
@ 2017-06-22 21:43 ` Gustavo A. R. Silva
-1 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 21:43 UTC (permalink / raw)
To: Borislav Petkov
Cc: Tony Luck, Mauro Carvalho Chehab, linux-edac, linux-kernel,
Qiuxu Zhuo
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
--
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment
@ 2017-06-22 21:43 ` Gustavo A. R. Silva
0 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 21:43 UTC (permalink / raw)
To: Borislav Petkov
Cc: Tony Luck, Mauro Carvalho Chehab, linux-edac, linux-kernel,
Qiuxu Zhuo
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [2/2] edac: pnd2_edac: remove useless variable assignment
2017-06-22 19:30 ` [PATCH 2/2] " Gustavo A. R. Silva
@ 2017-06-22 21:07 ` Borislav Petkov
-1 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2017-06-22 21:07 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Tony Luck, Mauro Carvalho Chehab, linux-edac, linux-kernel,
Qiuxu Zhuo
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.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 2/2] edac: pnd2_edac: remove useless variable assignment
@ 2017-06-22 21:07 ` Borislav Petkov
0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2017-06-22 21:07 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Tony Luck, Mauro Carvalho Chehab, linux-edac, linux-kernel,
Qiuxu Zhuo
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.
Thanks.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [1/2] edac: pnd2_edac: add code comment for clarification
@ 2017-06-22 19:26 ` Gustavo A. R. Silva
0 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 19:26 UTC (permalink / raw)
To: Tony Luck, Borislav Petkov, Mauro Carvalho Chehab
Cc: linux-edac, linux-kernel, Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional.
Addresses-Coverity-ID: 1403728
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/edac/pnd2_edac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 1cad5a9..c51ec73 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -174,6 +174,7 @@ static int apl_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
switch (sz) {
case 8:
ret = sbi_send(port, off + 4, op, (u32 *)(data + 4));
+ /* fall through */
case 4:
ret = sbi_send(port, off, op, (u32 *)data);
pnd2_printk(KERN_DEBUG, "%s=%x%08x ret=%d\n", name,
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 1/2] edac: pnd2_edac: add code comment for clarification
@ 2017-06-22 19:26 ` Gustavo A. R. Silva
0 siblings, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-22 19:26 UTC (permalink / raw)
To: Tony Luck, Borislav Petkov, Mauro Carvalho Chehab
Cc: linux-edac, linux-kernel, Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional.
Addresses-Coverity-ID: 1403728
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/edac/pnd2_edac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 1cad5a9..c51ec73 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -174,6 +174,7 @@ static int apl_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
switch (sz) {
case 8:
ret = sbi_send(port, off + 4, op, (u32 *)(data + 4));
+ /* fall through */
case 4:
ret = sbi_send(port, off, op, (u32 *)data);
pnd2_printk(KERN_DEBUG, "%s=%x%08x ret=%d\n", name,
--
2.5.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-06-23 7:53 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22 19:30 [2/2] edac: pnd2_edac: remove useless variable assignment Gustavo A. R. Silva
2017-06-22 19:30 ` [PATCH 2/2] " Gustavo A. R. Silva
-- strict thread matches above, loose matches on Subject: below --
2017-06-23 7:53 edac: pnd2_edac: add code comment for clarification and update " Borislav Petkov
2017-06-23 7:53 ` [PATCH] " Borislav Petkov
2017-06-22 22:05 Gustavo A. R. Silva
2017-06-22 22:05 ` [PATCH] " Gustavo A. R. Silva
2017-06-22 21:43 [2/2] edac: pnd2_edac: remove useless " Gustavo A. R. Silva
2017-06-22 21:43 ` [PATCH 2/2] " Gustavo A. R. Silva
2017-06-22 21:07 [2/2] " Borislav Petkov
2017-06-22 21:07 ` [PATCH 2/2] " Borislav Petkov
2017-06-22 19:26 [1/2] edac: pnd2_edac: add code comment for clarification Gustavo A. R. Silva
2017-06-22 19:26 ` [PATCH 1/2] " Gustavo A. R. Silva
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.