From: Anson Huang <[email protected]>
[ Upstream commit b663b798d04fb73f1ad4d54c46582d2fde7a76d6 ]
dev_err_probe() can reduce code size, uniform error handling and record the
defer probe reason etc., use it to simplify the code.
Signed-off-by: Anson Huang <[email protected]>
Reviewed-by: Guido Günther <[email protected]>
Signed-off-by: Shawn Guo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/soc/imx/gpcv2.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 6cf8a7a412bde..db7e7fc321b16 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -487,22 +487,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
domain->regulator = devm_regulator_get_optional(domain->dev, "power");
if (IS_ERR(domain->regulator)) {
- if (PTR_ERR(domain->regulator) != -ENODEV) {
- if (PTR_ERR(domain->regulator) != -EPROBE_DEFER)
- dev_err(domain->dev, "Failed to get domain's regulator\n");
- return PTR_ERR(domain->regulator);
- }
+ if (PTR_ERR(domain->regulator) != -ENODEV)
+ return dev_err_probe(domain->dev, PTR_ERR(domain->regulator),
+ "Failed to get domain's regulator\n");
} else if (domain->voltage) {
regulator_set_voltage(domain->regulator,
domain->voltage, domain->voltage);
}
ret = imx_pgc_get_clocks(domain);
- if (ret) {
- if (ret != -EPROBE_DEFER)
- dev_err(domain->dev, "Failed to get domain's clocks\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n");
ret = pm_genpd_init(&domain->genpd, NULL, true);
if (ret) {
--
2.25.1
Hi Sasha,
On Mon, Oct 26, 2020 at 8:56 PM Sasha Levin <[email protected]> wrote:
>
> From: Anson Huang <[email protected]>
>
> [ Upstream commit b663b798d04fb73f1ad4d54c46582d2fde7a76d6 ]
>
> dev_err_probe() can reduce code size, uniform error handling and record the
> defer probe reason etc., use it to simplify the code.
>
> Signed-off-by: Anson Huang <[email protected]>
> Reviewed-by: Guido Günther <[email protected]>
> Signed-off-by: Shawn Guo <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
Does this qualify for stable since it is just a cleanup and not a bug fix?
On Mon, Oct 26, 2020 at 08:59:34PM -0300, Fabio Estevam wrote:
>Hi Sasha,
>
>On Mon, Oct 26, 2020 at 8:56 PM Sasha Levin <[email protected]> wrote:
>>
>> From: Anson Huang <[email protected]>
>>
>> [ Upstream commit b663b798d04fb73f1ad4d54c46582d2fde7a76d6 ]
>>
>> dev_err_probe() can reduce code size, uniform error handling and record the
>> defer probe reason etc., use it to simplify the code.
>>
>> Signed-off-by: Anson Huang <[email protected]>
>> Reviewed-by: Guido G?nther <[email protected]>
>> Signed-off-by: Shawn Guo <[email protected]>
>> Signed-off-by: Sasha Levin <[email protected]>
>
>Does this qualify for stable since it is just a cleanup and not a bug fix?
Nope, I'm dropping it, thanks!
--
Thanks,
Sasha