Skip to contentSkip to conversation

ssb: Call ssb_bus_may_powerdown(bus) only once in ssb_bus_register()

PATCH In review Markus Elfring 2 participants 2 messages Sep 24, 2024 – Sep 25, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ssb: Call ssb_bus_may_powerdown(bus) only once in ssb_bus_register()

From: Markus Elfring <[email protected]>
Date: Tue, 24 Sep 2024 21:24:13 +0200

A ssb_bus_may_powerdown(bus) call was immediately used after a return value check for a ssb_fetch_invariants() call in this function implementation. Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

---
 drivers/ssb/main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ssb/main.c +2 -4
index aa6165e3db4a..458858b5472e 100644
@@ -663,11 +663,9 @@ ssb_bus_register(struct ssb_bus *bus,
 	ssb_extif_init(&bus->extif);
 	ssb_mipscore_init(&bus->mipscore);
 	err = ssb_fetch_invariants(bus, get_invariants);
-	if (err) {
-		ssb_bus_may_powerdown(bus);
-		goto err_pcmcia_exit;
-	}
 	ssb_bus_may_powerdown(bus);
+	if (err)
+		goto err_pcmcia_exit;
 
 	/* Queue it for attach.
 	 * See the comment at the ssb_is_early_boot definition.

--
2.46.1

maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Tue, 24 Sep 2024 21:33:49 +0200 Markus Elfring <[email protected]> wrote:
drivers/ssb/main.c +0 -0
index aa6165e3db4a..458858b5472e 100644
@@ -663,11 +663,9 @@ ssb_bus_register(struct ssb_bus *bus,
 	ssb_extif_init(&bus->extif);
 	ssb_mipscore_init(&bus->mipscore);
 	err = ssb_fetch_invariants(bus, get_invariants);

drivers/ssb/main.c ssb_bus_register(struct ssb_bus *bus, · line 671

Quoted 10 lines
drivers/ssb/main.c +2 -4
-	if (err) {
-		ssb_bus_may_powerdown(bus);
-		goto err_pcmcia_exit;
-	}
 	ssb_bus_may_powerdown(bus);
+	if (err)
+		goto err_pcmcia_exit;
 
 	/* Queue it for attach.
 	 * See the comment at the ssb_is_early_boot definition.
Signature · 2 lines
Michael Büsch
https://bues.ch/