[PATCH] soc: brcmstb: pm: Add of_node_put() when the iteration breaks
Arnd Bergmann
arnd at arndb.de
Tue Jul 5 06:09:19 PDT 2022
On Tue, Jul 5, 2022 at 2:18 PM Liang He <windhl at 126.com> wrote:
> At 2022-07-05 19:54:05, "Arnd Bergmann" <arnd at arndb.de> wrote:
>
> Thanks very much for your reply and your advice.
>
> I would like to give more useful patching work, but now I have only learned
> the 'device_node' related OF APIs.
>
> It will be easies if you could provide a special case to teach me how to patch
> of_io_xx related bugs or just a related link in lore.kernel.org.
The general rule is that for anything that happens in the probe() function,
you have to negate what happened in case the probe function fails.
If you look at drivers/soc/bcm/brcmstb/pm/pm-mips.c, you find that
its probe function has an iounmap() for each ioremap().
Alternatively, you can also use 'devm_*()' functions that do an
automatic cleanup when a probe function fails, or when the
remove function returns (which this driver does not have).
Arnd
More information about the linux-arm-kernel
mailing list