public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] floppy: add missing put_device()
       [not found] <20230718080812.16801-1-xujianghui@cdjrlc.com>
@ 2023-07-18  8:09 ` sunran001
  2023-07-18  8:51   ` Kjetil Oftedal
  0 siblings, 1 reply; 4+ messages in thread
From: sunran001 @ 2023-07-18  8:09 UTC (permalink / raw)
  To: davem; +Cc: sparclinux, linux-kernel

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.

Signed-off-by: Ran Sun <sunran001@208suo.com>
---
  arch/sparc/include/asm/floppy_64.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/sparc/include/asm/floppy_64.h 
b/arch/sparc/include/asm/floppy_64.h
index 070c8c1f5c8f..e74a4d4e6519 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -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];

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] floppy: add missing put_device()
  2023-07-18  8:09 ` sunran001
@ 2023-07-18  8:51   ` Kjetil Oftedal
  0 siblings, 0 replies; 4+ messages in thread
From: Kjetil Oftedal @ 2023-07-18  8:51 UTC (permalink / raw)
  To: sunran001; +Cc: davem, sparclinux, linux-kernel

On Tue, 18 Jul 2023 at 10:15, <sunran001@208suo.com> 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.
>
> Signed-off-by: Ran Sun <sunran001@208suo.com>
> ---
>   arch/sparc/include/asm/floppy_64.h | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/sparc/include/asm/floppy_64.h
> b/arch/sparc/include/asm/floppy_64.h
> index 070c8c1f5c8f..e74a4d4e6519 100644
> --- a/arch/sparc/include/asm/floppy_64.h
> +++ b/arch/sparc/include/asm/floppy_64.h
> @@ -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)


>               return 0;
>
>           FLOPPY_IRQ = op->archdata.irqs[0];

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] floppy: add missing put_device()
       [not found] <20230718090203.17548-1-xujianghui@cdjrlc.com>
@ 2023-07-18  9:02 ` sunran001
  2023-07-18 14:51   ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: sunran001 @ 2023-07-18  9:02 UTC (permalink / raw)
  To: davem; +Cc: sparclinux, linux-kernel

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

./arch/sparc/include/asm/floppy_64.h:562:1-22: WARNING: Function
"for_each_node_by_name" should have of_node_put() before break around
line 567.

Signed-off-by: Ran Sun <sunran001@208suo.com>
---
  arch/sparc/include/asm/floppy_64.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/include/asm/floppy_64.h 
b/arch/sparc/include/asm/floppy_64.h
index 53e77c0974f9..619255e8c9ac 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -594,7 +594,7 @@ static unsigned long __init sun_floppy_init(void)
          if (state_prop && !strncmp(state_prop, "disabled", 8)) {
              put_device(&op->dev);
              return 0;
-        }
+        }

          FLOPPY_IRQ = op->archdata.irqs[0];

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] floppy: add missing put_device()
  2023-07-18  9:02 ` [PATCH] floppy: add missing put_device() sunran001
@ 2023-07-18 14:51   ` Sam Ravnborg
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2023-07-18 14:51 UTC (permalink / raw)
  To: sunran001; +Cc: davem, sparclinux, linux-kernel

Hi Ran Sun,

On Tue, Jul 18, 2023 at 05:02:54PM +0800, sunran001@208suo.com wrote:
> The of_find_device_by_node() takes a reference to the underlying device
> structure, we should release that reference.
> 
> ./arch/sparc/include/asm/floppy_64.h:562:1-22: WARNING: Function
> "for_each_node_by_name" should have of_node_put() before break around
> line 567.
> 
> Signed-off-by: Ran Sun <sunran001@208suo.com>
> ---
>  arch/sparc/include/asm/floppy_64.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sparc/include/asm/floppy_64.h
> b/arch/sparc/include/asm/floppy_64.h
> index 53e77c0974f9..619255e8c9ac 100644
> --- a/arch/sparc/include/asm/floppy_64.h
> +++ b/arch/sparc/include/asm/floppy_64.h
> @@ -594,7 +594,7 @@ static unsigned long __init sun_floppy_init(void)
>          if (state_prop && !strncmp(state_prop, "disabled", 8)) {
>              put_device(&op->dev);
>              return 0;
> -        }
> +        }
> 
>          FLOPPY_IRQ = op->archdata.irqs[0];

The patch does not include any changes. Please redo.

	Sam


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-18 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230718090203.17548-1-xujianghui@cdjrlc.com>
2023-07-18  9:02 ` [PATCH] floppy: add missing put_device() sunran001
2023-07-18 14:51   ` Sam Ravnborg
     [not found] <20230718080812.16801-1-xujianghui@cdjrlc.com>
2023-07-18  8:09 ` sunran001
2023-07-18  8:51   ` Kjetil Oftedal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox