mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch
PATCH 1/1 mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() checks null pointer.
Fixes ea35645a3c66 ("mmc: sdhci-of-esdhc: add support for signal voltage switch")
Signed-off-by Miaoqian Lin <[email protected]>
--- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-of-esdhc.c +1 -0
@@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, scfg_node =of_find_matching_node (NULL , scfg_device_ids);if (scfg_node) scfg_base =of_iomap (scfg_node,0 ); +of_node_put (scfg_node);if (scfg_base) { sdhciovselcr =SDHCIOVSELCR_TGLEN |SDHCIOVSELCR_VSELVAL ;
Signature · 1 line
2.25.1
Ulf Hansson
AppliedQuoted 8 lines · Miaoqian Lin
of_find_matching_node()returns a node pointer with refcount incremented, we should useof_node_put()on it when not need anymore. Add missingof_node_put()to avoid refcount leak.of_node_put()checks null pointer.Fixes ea35645a3c66 ("mmc: sdhci-of-esdhc: add support for signal voltage switch")Signed-off-by Miaoqian Lin <[email protected]>
Queued for v5.20 on the devel branch, thanks!
Kind regards
Uffe
Quoted 19 lines
--- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+)drivers/mmc/host/sdhci-of-esdhc.c +1
-1@@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, scfg_node =of_find_matching_node (NULL , scfg_device_ids);if (scfg_node) scfg_base =of_iomap (scfg_node,0 ); +of_node_put (scfg_node);if (scfg_base) { sdhciovselcr =SDHCIOVSELCR_TGLEN |SDHCIOVSELCR_VSELVAL ; --2.25.1