Skip to contentSkip to conversation

floppy:ERROR: missing put_device; call of_find_device_by_node on line 589, but without a corresponding object release within this function. Add the put_device function before return to release memory

PATCH In review [email protected] 2 participants 3 messages Jul 14, 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:ERROR: missing put_device; call of_find_device_by_node on line 589, but without a corresponding object release within this function. Add the put_device function before return to release memory

---
 arch/sparc/include/asm/floppy_64.h | 1 +
 1 file changed, 1 insertion(+)
arch/sparc/include/asm/floppy_64.h +1 -0
index 070c8c1f5c8f..c4c51f494f25 100644
@@ -588,6 +588,7 @@ static unsigned long __init sun_floppy_init(void)
 
         op = of_find_device_by_node(dp);
         if (!op)
+            put_device(op);
             return 0;
 
         state_prop = of_get_property(op->dev.of_node, "status", NULL);
#2 lore raw

Hi LiuBin

Quoted 11 lines · On Fri, Jul 14, 2023 at 12:56:29PM +0800, [email protected] wrote:
---
 arch/sparc/include/asm/floppy_64.h | 1 +
 1 file changed, 1 insertion(+)
arch/sparc/include/asm/floppy_64.h +0 -0
index 070c8c1f5c8f..c4c51f494f25 100644

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

Quoted 5 lines
arch/sparc/include/asm/floppy_64.h +1 -0
@@ -588,6 +588,7 @@ static unsigned long __init sun_floppy_init(void)
 
         op = of_find_device_by_node(dp);
         if (!op)
+            put_device(op);
             return 0;

This does not look right as the code will always return 0 now, independent on the if test. You missed a set of curly braces.

Sam

Quoted 2 lines
arch/sparc/include/asm/floppy_64.h +0 -0
         state_prop = of_get_property(op->dev.of_node, "status", NULL);
#3 lore raw

Hi LiuBin.

Quoted 15 lines · Sam Ravnborg

Hi LiuBin

Quoted 12 lines · On Fri, Jul 14, 2023 at 12:56:29PM +0800, [email protected] wrote:
---
 arch/sparc/include/asm/floppy_64.h | 1 +
 1 file changed, 1 insertion(+)
arch/sparc/include/asm/floppy_64.h +0 -0
index 070c8c1f5c8f..c4c51f494f25 100644
@@ -588,6 +588,7 @@ static unsigned long __init sun_floppy_init(void)
 
Quoted 7 lines

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

Quoted 4 lines
arch/sparc/include/asm/floppy_64.h +1 -0
         op = of_find_device_by_node(dp);
         if (!op)
+            put_device(op);
             return 0;

This does not look right as the code will always return 0 now, independent on the if test. You missed a set of curly braces.

Two more notes.
Please put the description of the fix in the body of the mail. Right now it is a very long subject - and we try to keep subject shorter than ~70 chars.

Quoted 1 line
Quoted 1 line

You are expected to sign-off the patch with you name and not a nickname. If LiuBin is indeed you name then sorry and ignore this comment.

I look forward to the updated patch.

Sam