[PATCH] soc/tegra: pmc: Check device node status property

Petlozu Pravareshwar posted 1 patch 3 years, 7 months ago
drivers/soc/tegra/pmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] soc/tegra: pmc: Check device node status property
Posted by Petlozu Pravareshwar 3 years, 7 months ago
In early_initcall, check if PMC device is available for use
and avoid accessing PMC resources if the device node status
property is set to disabled.

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 6a86961477e8..8c7b46ac6ad6 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -4295,7 +4295,7 @@ static int __init tegra_pmc_early_init(void)
 		return -ENXIO;
 	}
 
-	if (np) {
+	if (of_device_is_available(np)) {
 		pmc->soc = match->data;
 
 		if (pmc->soc->maybe_tz_only)
-- 
2.17.1
Re: [PATCH] soc/tegra: pmc: Check device node status property
Posted by Thierry Reding 3 years, 6 months ago
On Tue, Sep 06, 2022 at 01:51:17PM +0000, Petlozu Pravareshwar wrote:
> In early_initcall, check if PMC device is available for use
> and avoid accessing PMC resources if the device node status
> property is set to disabled.
> 
> Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
> Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
> ---
>  drivers/soc/tegra/pmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry