linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl
@ 2021-09-07 10:59 Colin King
  2021-09-07 11:11 ` Borislav Petkov
  2021-09-07 12:56 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2021-09-07 10:59 UTC (permalink / raw)
  To: Borislav Petkov, Mauro Carvalho Chehab, Tony Luck, James Morse,
	Robert Richter, linux-edac
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable dev_ctl is being initialized with a value that is never
read, it is being updated later on. The assignment is redundant and
can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/edac/edac_device.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 8c4d947fb848..a337f7afc3b9 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -75,7 +75,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
 	 * provide if we could simply hardcode everything into a single struct.
 	 */
 	p = NULL;
-	dev_ctl = edac_align_ptr(&p, sizeof(*dev_ctl), 1);
 
 	/* Calc the 'end' offset past end of ONE ctl_info structure
 	 * which will become the start of the 'instance' array
-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl
  2021-09-07 10:59 [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl Colin King
@ 2021-09-07 11:11 ` Borislav Petkov
  2021-09-07 11:17   ` NACK: " Colin Ian King
  2021-09-07 12:56 ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2021-09-07 11:11 UTC (permalink / raw)
  To: Colin King
  Cc: Mauro Carvalho Chehab, Tony Luck, James Morse, Robert Richter,
	linux-edac, kernel-janitors, linux-kernel

On Tue, Sep 07, 2021 at 11:59:13AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable dev_ctl is being initialized with a value that is never
> read, it is being updated later on. The assignment is redundant and
> can be removed.
> 
> Addresses-Coverity: ("Unused value")

I'll never get a public reference to what those things mean, will I?

> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/edac/edac_device.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
> index 8c4d947fb848..a337f7afc3b9 100644
> --- a/drivers/edac/edac_device.c
> +++ b/drivers/edac/edac_device.c
> @@ -75,7 +75,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
>  	 * provide if we could simply hardcode everything into a single struct.
>  	 */
>  	p = NULL;
> -	dev_ctl = edac_align_ptr(&p, sizeof(*dev_ctl), 1);

Are you absolutely sure this function doesn't have any side-effects,
say, to &p and removing the call would break the pointer offsets for the
one-shot allocation?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 4+ messages in thread

* NACK: [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl
  2021-09-07 11:11 ` Borislav Petkov
@ 2021-09-07 11:17   ` Colin Ian King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2021-09-07 11:17 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Mauro Carvalho Chehab, Tony Luck, James Morse, Robert Richter,
	linux-edac, kernel-janitors, linux-kernel

On 07/09/2021 12:11, Borislav Petkov wrote:
> On Tue, Sep 07, 2021 at 11:59:13AM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The variable dev_ctl is being initialized with a value that is never
>> read, it is being updated later on. The assignment is redundant and
>> can be removed.
>>
>> Addresses-Coverity: ("Unused value")
> 
> I'll never get a public reference to what those things mean, will I?
> 
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/edac/edac_device.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
>> index 8c4d947fb848..a337f7afc3b9 100644
>> --- a/drivers/edac/edac_device.c
>> +++ b/drivers/edac/edac_device.c
>> @@ -75,7 +75,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
>>  	 * provide if we could simply hardcode everything into a single struct.
>>  	 */
>>  	p = NULL;
>> -	dev_ctl = edac_align_ptr(&p, sizeof(*dev_ctl), 1);
> 
> Are you absolutely sure this function doesn't have any side-effects,
> say, to &p and removing the call would break the pointer offsets for the
> one-shot allocation?

Oops. brown-paper-bag on head. It does alter p. NACK.

> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl
  2021-09-07 10:59 [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl Colin King
  2021-09-07 11:11 ` Borislav Petkov
@ 2021-09-07 12:56 ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-09-07 12:56 UTC (permalink / raw)
  To: Colin King
  Cc: Borislav Petkov, Mauro Carvalho Chehab, Tony Luck, James Morse,
	Robert Richter, linux-edac, kernel-janitors, linux-kernel

On Tue, Sep 07, 2021 at 11:59:13AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable dev_ctl is being initialized with a value that is never
> read, it is being updated later on. The assignment is redundant and
> can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/edac/edac_device.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
> index 8c4d947fb848..a337f7afc3b9 100644
> --- a/drivers/edac/edac_device.c
> +++ b/drivers/edac/edac_device.c
> @@ -75,7 +75,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
>  	 * provide if we could simply hardcode everything into a single struct.
>  	 */
>  	p = NULL;
> -	dev_ctl = edac_align_ptr(&p, sizeof(*dev_ctl), 1);
                                 ^^
This sets "p" up for the next call so I think it's required.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-07 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 10:59 [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl Colin King
2021-09-07 11:11 ` Borislav Petkov
2021-09-07 11:17   ` NACK: " Colin Ian King
2021-09-07 12:56 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).