mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] soc: fix comment for freeing soc_dev_attr
@ 2020-12-07 18:59 Krzysztof Kozlowski
  2020-12-08  9:13 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2020-12-07 18:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel
  Cc: Lee Jones, Arnd Bergmann, Geert Uytterhoeven, Krzysztof Kozlowski

The soc_dev_attr is stored soc_dev->attr during soc_device_register() so
it could be used till the cleanup call: soc_device_unregister().
Therefore this memory should not be freed prior, but after unregistering
soc device.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/base/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index d34609bb7386..0af5363a582c 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -168,7 +168,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
 }
 EXPORT_SYMBOL_GPL(soc_device_register);
 
-/* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
+/* Ensure soc_dev->attr is freed after calling soc_device_unregister. */
 void soc_device_unregister(struct soc_device *soc_dev)
 {
 	device_unregister(&soc_dev->dev);
-- 
2.25.1


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

* Re: [PATCH] soc: fix comment for freeing soc_dev_attr
  2020-12-07 18:59 [PATCH] soc: fix comment for freeing soc_dev_attr Krzysztof Kozlowski
@ 2020-12-08  9:13 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2020-12-08  9:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Linux Kernel Mailing List,
	Lee Jones, Arnd Bergmann, Geert Uytterhoeven

Hi Krzysztof,

On Mon, Dec 7, 2020 at 8:00 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> The soc_dev_attr is stored soc_dev->attr during soc_device_register() so
> it could be used till the cleanup call: soc_device_unregister().
> Therefore this memory should not be freed prior, but after unregistering
> soc device.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Thanks for your patch!

> --- a/drivers/base/soc.c
> +++ b/drivers/base/soc.c
> @@ -168,7 +168,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
>  }
>  EXPORT_SYMBOL_GPL(soc_device_register);
>
> -/* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
> +/* Ensure soc_dev->attr is freed after calling soc_device_unregister. */

"Ensure" makes it sound like the freeing is taken care of, which is not,
as it should be handled by the caller.

What about "soc_dev->attr should be freed after calling soc_device_unregister."?

>  void soc_device_unregister(struct soc_device *soc_dev)
>  {
>         device_unregister(&soc_dev->dev);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2020-12-08  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 18:59 [PATCH] soc: fix comment for freeing soc_dev_attr Krzysztof Kozlowski
2020-12-08  9:13 ` Geert Uytterhoeven

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

Powered by JetHome