Skip to contentSkip to conversation

PM / wakeup: remove redundant assignment to variable retval

PATCH Applied Colin King 2 participants 2 messages Apr 16, 2021 – Apr 22, 2021

Subsystems (5)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 PM / wakeup: remove redundant assignment to variable retval

From: Colin Ian King <[email protected]>

The variable retval is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/base/power/wakeup_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup_stats.c +1 -1
index 5ade7539ac02..924fac493c4f 100644
@@ -137,7 +137,7 @@ static struct device *wakeup_source_device_create(struct device *parent,
 						  struct wakeup_source *ws)
 {
 	struct device *dev = NULL;
-	int retval = -ENODEV;
+	int retval;
 
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev) {
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 18 lines · Colin King

From: Colin Ian King <[email protected]>

The variable retval is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/base/power/wakeup_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup_stats.c +0 -0
index 5ade7539ac02..924fac493c4f 100644

drivers/base/power/wakeup_stats.c static struct device *wakeup_source_device_create(struct device *parent,

Quoted 9 lines
drivers/base/power/wakeup_stats.c +1 -2
@@ -137,7 +137,7 @@ static struct device *wakeup_source_device_create(struct device *parent,
                                                  struct wakeup_source *ws)
 {
        struct device *dev = NULL;
-       int retval = -ENODEV;
+       int retval;
 
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (!dev) {
--

Applied as 5.13 material, thanks!