Skip to contentSkip to conversation

floppy: add missing put_device()

PATCH In review [email protected] 2 participants 2 messages Jul 18, 2023 1 message not in the archive SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 floppy: add missing put_device()

The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.

Detected by coccinelle with the following ERROR:
./arch/sparc/include/asm/floppy_64.h:595:3-9: ERROR: missing put_device; call of_find_device_by_node on line 589, but without a corresponding object release within this function.

---
 arch/sparc/include/asm/floppy_64.h | 1 +
 1 file changed, 1 insertion(+)
arch/sparc/include/asm/floppy_64.h +1 -0
index 070c8c1f5c8f..e74a4d4e6519 100644
@@ -592,6 +592,7 @@ static unsigned long __init sun_floppy_init(void)
 
         state_prop = of_get_property(op->dev.of_node, "status", NULL);
         if (state_prop && !strncmp(state_prop, "disabled", 8))
+            put_device(&op->dev);
             return 0;
 
         FLOPPY_IRQ = op->archdata.irqs[0];
#2 lore raw
Quoted 20 lines · On Tue, 18 Jul 2023 at 10:15, <[email protected]> wrote:

The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.

Detected by coccinelle with the following ERROR:
./arch/sparc/include/asm/floppy_64.h:595:3-9: ERROR: missing put_device; call of_find_device_by_node on line 589, but without a corresponding object release within this function.

---
  arch/sparc/include/asm/floppy_64.h | 1 +
  1 file changed, 1 insertion(+)
arch/sparc/include/asm/floppy_64.h +0 -0
index 070c8c1f5c8f..e74a4d4e6519 100644

arch/sparc/include/asm/floppy_64.h static unsigned long __init sun_floppy_init(void) · line 595

Quoted 4 lines
arch/sparc/include/asm/floppy_64.h +1 -0
@@ -592,6 +592,7 @@ static unsigned long __init sun_floppy_init(void)
 
          state_prop = of_get_property(op->dev.of_node, "status", NULL);
          if (state_prop && !strncmp(state_prop, "disabled", 8))
+            put_device(&op->dev);

From the same domain as "Liubin" earlier, introducing the same kind of error (Not adding curly braces)

Quoted 3 lines
arch/sparc/include/asm/floppy_64.h +0 -0
              return 0;
 
          FLOPPY_IRQ = op->archdata.irqs[0];