From de48d8766afcd97d147699aaff78a338081c9973 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 22 Oct 2022 14:56:55 +0200 Subject: [PATCH 1/3] thermal/drivers/qcom/tsens: Init debugfs only with successful probe Calibrate and tsens_register can fail or PROBE_DEFER. This will cause a double or a wrong init of the debugfs information. Init debugfs only with successful probe fixing warning about directory already present. Signed-off-by: Christian Marangi Acked-by: Thara Gopinath Link: https://lore.kernel.org/r/20221022125657.22530-2-ansuelsmth@gmail.com Signed-off-by: Daniel Lezcano --- drivers/thermal/qcom/tsens.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -918,8 +918,6 @@ int __init init_common(struct tsens_priv if (tsens_version(priv) >= VER_0_1) tsens_enable_irq(priv); - tsens_debug_init(op); - err_put_device: put_device(&op->dev); return ret; @@ -1156,7 +1154,11 @@ static int tsens_probe(struct platform_d } } - return tsens_register(priv); + ret = tsens_register(priv); + if (!ret) + tsens_debug_init(pdev); + + return ret; } static int tsens_remove(struct platform_device *pdev)