Skip to contentSkip to conversation

ACPI: battery: Remove redundant NULL initalizations

PATCH Applied Ilpo Järvinen 2 participants 2 messages Jul 31, 2024 – Aug 2, 2024 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: battery: Remove redundant NULL initalizations

A local 'battery' variable is initialized to NULL on two occassions where it is unconditionally rewritten later. Remove the unnecessary initializations.

---
 drivers/acpi/battery.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/battery.c +2 -2
index da3a879d638a..06e84d21ba3b 100644
@@ -1207,7 +1207,7 @@ static int acpi_battery_update_retry(struct acpi_battery *battery)
 static int acpi_battery_add(struct acpi_device *device)
 {
 	int result = 0;
-	struct acpi_battery *battery = NULL;
+	struct acpi_battery *battery;
 
 	if (!device)
 		return -EINVAL;
@@ -1260,7 +1260,7 @@ static int acpi_battery_add(struct acpi_device *device)
 
 static void acpi_battery_remove(struct acpi_device *device)
 {
-	struct acpi_battery *battery = NULL;
+	struct acpi_battery *battery;
 
 	if (!device || !acpi_driver_data(device))
 		return;
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 24 lines · Ilpo Järvinen

A local 'battery' variable is initialized to NULL on two occassions where it is unconditionally rewritten later. Remove the unnecessary initializations.

---
 drivers/acpi/battery.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/battery.c +1 -1
index da3a879d638a..06e84d21ba3b 100644
@@ -1207,7 +1207,7 @@ static int acpi_battery_update_retry(struct acpi_battery *battery)
 static int acpi_battery_add(struct acpi_device *device)
 {
        int result = 0;
-       struct acpi_battery *battery = NULL;
+       struct acpi_battery *battery;
 
        if (!device)
                return -EINVAL;

drivers/acpi/battery.c static int acpi_battery_add(struct acpi_device *device)

Quoted 9 lines
drivers/acpi/battery.c +1 -2
@@ -1260,7 +1260,7 @@ static int acpi_battery_add(struct acpi_device *device)
 
 static void acpi_battery_remove(struct acpi_device *device)
 {
-       struct acpi_battery *battery = NULL;
+       struct acpi_battery *battery;
 
        if (!device || !acpi_driver_data(device))
                return;
--

Applied as 6.12 material, thanks!