Re: [PATCH] mmc/host/sdhci-of-esdhc: Hold a reference returned by of_find_compatible_node

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

 



On 21/06/22 09:52, Liang He wrote:
> In sdhci_esdhc_probe(), we should hold the reference returned by
> of_find_compatible_node() which is used to of_node_put() for keep
> refcount balance.
> 
> Signed-off-by: Liang He <windhl@xxxxxxx>

Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>

> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index d9dc41143bb3..9c8cd8b63578 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -1418,7 +1418,7 @@ static int esdhc_hs400_prepare_ddr(struct mmc_host *mmc)
>  static int sdhci_esdhc_probe(struct platform_device *pdev)
>  {
>  	struct sdhci_host *host;
> -	struct device_node *np;
> +	struct device_node *np, *tp;
>  	struct sdhci_pltfm_host *pltfm_host;
>  	struct sdhci_esdhc *esdhc;
>  	int ret;
> @@ -1463,7 +1463,9 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
>  	if (esdhc->vendor_ver > VENDOR_V_22)
>  		host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ;
>  
> -	if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) {
> +	tp = of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc");
> +	if (tp) {
> +		of_node_put(tp);
>  		host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
>  		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>  	}




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux