Skip to contentSkip to conversation

EDAC/device: Remove redundant initialization of pointer dev_ctl

PATCH In review Colin King 3 participants 4 messages Sep 7, 2021

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 EDAC/device: Remove redundant initialization of pointer dev_ctl

From: Colin Ian King <[email protected]>

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")

---
 drivers/edac/edac_device.c | 1 -
 1 file changed, 1 deletion(-)
drivers/edac/edac_device.c +0 -1
index 8c4d947fb848..a337f7afc3b9 100644
@@ -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
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 7 lines · Colin King

From: Colin Ian King <[email protected]>

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?

Quoted 10 lines
---
 drivers/edac/edac_device.c | 1 -
 1 file changed, 1 deletion(-)
drivers/edac/edac_device.c +0 -0
index 8c4d947fb848..a337f7afc3b9 100644

drivers/edac/edac_device.c struct edac_device_ctl_info *edac_device_alloc_ctl_info( · line 78

Quoted 4 lines
drivers/edac/edac_device.c +0 -1
@@ -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?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw

NACK: [PATCH] EDAC/device: Remove redundant initialization of pointer dev_ctl

Quoted 16 lines · Borislav Petkov
Quoted 7 lines · Colin King

From: Colin Ian King <[email protected]>

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?

Quoted 5 lines
---
 drivers/edac/edac_device.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 13 lines

drivers/edac/edac_device.c struct edac_device_ctl_info *edac_device_alloc_ctl_info( · line 78

Quoted 9 lines
drivers/edac/edac_device.c +0 -1
index 8c4d947fb848..a337f7afc3b9 100644
@@ -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.

Quoted 1 line
#3 lore raw
In reply to Colin King
Quoted 17 lines · Colin King

From: Colin Ian King <[email protected]>

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")

---
 drivers/edac/edac_device.c | 1 -
 1 file changed, 1 deletion(-)
drivers/edac/edac_device.c +0 -0
index 8c4d947fb848..a337f7afc3b9 100644

drivers/edac/edac_device.c struct edac_device_ctl_info *edac_device_alloc_ctl_info( · line 78

Quoted 4 lines
drivers/edac/edac_device.c +0 -1
@@ -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