diff mbox series

[-next] pmdomain: mediatek: make use of dev_err_cast_probe()

Message ID 20240828121230.3696315-1-lihongbo22@huawei.com (mailing list archive)
State New
Headers show
Series [-next] pmdomain: mediatek: make use of dev_err_cast_probe() | expand

Commit Message

Hongbo Li Aug. 28, 2024, 12:12 p.m. UTC
Using dev_err_cast_probe() to simplify the code.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/pmdomain/mediatek/mtk-pm-domains.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Matthias Brugger Sept. 2, 2024, 11:12 a.m. UTC | #1
On 28/08/2024 14:12, Hongbo Li wrote:
> Using dev_err_cast_probe() to simplify the code.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
>   drivers/pmdomain/mediatek/mtk-pm-domains.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c
> index e274e3315fe7..88406e9ac63c 100644
> --- a/drivers/pmdomain/mediatek/mtk-pm-domains.c
> +++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c
> @@ -398,12 +398,10 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
>   		scpsys->dev->of_node = node;
>   		pd->supply = devm_regulator_get(scpsys->dev, "domain");
>   		scpsys->dev->of_node = root_node;
> -		if (IS_ERR(pd->supply)) {
> -			dev_err_probe(scpsys->dev, PTR_ERR(pd->supply),
> +		if (IS_ERR(pd->supply))
> +			return dev_err_cast_probe(scpsys->dev, pd->supply,
>   				      "%pOF: failed to get power supply.\n",
>   				      node);
> -			return ERR_CAST(pd->supply);
> -		}
>   	}
>   
>   	pd->infracfg = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,infracfg");
Ulf Hansson Sept. 13, 2024, 12:01 p.m. UTC | #2
On Wed, 28 Aug 2024 at 14:04, Hongbo Li <lihongbo22@huawei.com> wrote:
>
> Using dev_err_cast_probe() to simplify the code.
>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/pmdomain/mediatek/mtk-pm-domains.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c
> index e274e3315fe7..88406e9ac63c 100644
> --- a/drivers/pmdomain/mediatek/mtk-pm-domains.c
> +++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c
> @@ -398,12 +398,10 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
>                 scpsys->dev->of_node = node;
>                 pd->supply = devm_regulator_get(scpsys->dev, "domain");
>                 scpsys->dev->of_node = root_node;
> -               if (IS_ERR(pd->supply)) {
> -                       dev_err_probe(scpsys->dev, PTR_ERR(pd->supply),
> +               if (IS_ERR(pd->supply))
> +                       return dev_err_cast_probe(scpsys->dev, pd->supply,
>                                       "%pOF: failed to get power supply.\n",
>                                       node);
> -                       return ERR_CAST(pd->supply);
> -               }
>         }
>
>         pd->infracfg = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,infracfg");
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c
index e274e3315fe7..88406e9ac63c 100644
--- a/drivers/pmdomain/mediatek/mtk-pm-domains.c
+++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c
@@ -398,12 +398,10 @@  generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
 		scpsys->dev->of_node = node;
 		pd->supply = devm_regulator_get(scpsys->dev, "domain");
 		scpsys->dev->of_node = root_node;
-		if (IS_ERR(pd->supply)) {
-			dev_err_probe(scpsys->dev, PTR_ERR(pd->supply),
+		if (IS_ERR(pd->supply))
+			return dev_err_cast_probe(scpsys->dev, pd->supply,
 				      "%pOF: failed to get power supply.\n",
 				      node);
-			return ERR_CAST(pd->supply);
-		}
 	}
 
 	pd->infracfg = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,infracfg");