Skip to contentSkip to conversation

pwm: tegra: check reset deassertion status

PATCH Superseded Pengpeng Hou 2 participants 2 messages Oct 14 – Dec 1

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pwm: tegra: check reset deassertion status

Check reset_control_deassert() before registering the PWM chip and use the existing runtime-PM cleanup path if it reports an error.

This is an API-consistency change, not a claim of an observed failure on supported Tegra systems. Keep the existing reset assertion before PM teardown in remove and the pwmchip_add() failure path.

The issue was found by our static-analysis tool and manually reviewed.

---
Changes since v1:
- drop Fixes and stable-backport implications, as Thierry requested
- retain the small status check and Thierry's Acked-by
- keep explicit reset ownership: moving assert to devres would put it after the driver's PM teardown, rather than preserve the existing order

Previous version:
https://lore.kernel.org/all/[email protected]/

 drivers/pwm/pwm-tegra.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pwm/pwm-tegra.c +3 -1
index 5cdbe120ba2d8dafd81ea5520f1a637827d8eecf..d9fa16a7b31f43bd9d75474f851899956159d836 100644
@@ -379,7 +379,9 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 		goto put_pm;
 	}
 
-	reset_control_deassert(pc->rst);
+	ret = reset_control_deassert(pc->rst);
+	if (ret)
+		goto put_pm;
 
 	chip->ops = &tegra_pwm_ops;
 

base-commit: 4056b3c9d3c92ea45955641dbafeb9b960e146ef

#1 lore raw

Hello,

Quoted 5 lines · Pengpeng Hou
drivers/pwm/pwm-tegra.c +0 -0
index 5cdbe120ba2d8dafd81ea5520f1a637827d8eecf..d9fa16a7b31f43bd9d75474f851899956159d836 100644

drivers/pwm/pwm-tegra.c static int tegra_pwm_probe(struct platform_device *pdev) · line 386

Quoted 9 lines
drivers/pwm/pwm-tegra.c +3 -1
@@ -379,7 +379,9 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 		goto put_pm;
 	}
 
-	reset_control_deassert(pc->rst);
+	ret = reset_control_deassert(pc->rst);
+	if (ret)
+		goto put_pm;
 
 	chip->ops = &tegra_pwm_ops;

reset_control_deassert() doesn't emit an error message on failure, so a dev_err_probe() is deserved here.

(The driver doesn't use dev_err_probe() yet, but this is addressed in
https://lore.kernel.org/linux-pwm/280e3b3af15fc6d5a9531639f9114ad79e2033c8.1796147495.git.u.kleine-koenig@baylibre.com/.)

Best regards
Uwe