Re: [PATCH] arm/mach: Hold reference returned by of_find_xxx APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Liang He <windhl@xxxxxxx> [220621 12:14]:
> diff --git a/arch/arm/mach-omap2/pmic-cpcap.c b/arch/arm/mach-omap2/pmic-cpcap.c
> index 668dc84fd31e..a7368d657aa8 100644
> --- a/arch/arm/mach-omap2/pmic-cpcap.c
> +++ b/arch/arm/mach-omap2/pmic-cpcap.c
> @@ -238,8 +238,11 @@ static struct omap_voltdm_pmic omap4_fan_iva = {
>  int __init omap4_cpcap_init(void)
>  {
>  	struct voltagedomain *voltdm;
> +	struct device_node *np;
>  
> -	if (!of_find_compatible_node(NULL, NULL, "motorola,cpcap"))
> +	np = of_find_compatible_node(NULL, NULL, "motorola,cpcap");
> +	of_node_put(np);
> +	if (!np)
>  		return -ENODEV;

Hmm so here you are checking for !np after of_node_put()?

> diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
> index 4e1ee70b2a3f..2aeac041bcb9 100644
> --- a/arch/arm/mach-tegra/irq.c
> +++ b/arch/arm/mach-tegra/irq.c
> @@ -88,7 +88,11 @@ static const struct of_device_id tegra_ictlr_match[] __initconst = {
>  
>  void __init tegra_init_irq(void)
>  {
> -	if (WARN_ON(!of_find_matching_node(NULL, tegra_ictlr_match)))
> +	struct device_node *np;
> +
> +	np = of_find_matching_node(NULL, tegra_ictlr_match);
> +	of_node_put(np);
> +	if (WARN_ON(!np))
>  		pr_warn("Outdated DT detected, suspend/resume will NOT work\n");
>  
>  	tegra114_gic_cpu_pm_registration();

Here too.

Regards,

Tony



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux