On Mon, 10. Mar 10:53, Frank Li wrote:
On Sun, Mar 09, 2025 at 08:57:58PM +0300, Fedor Pchelkin wrote:
Upon encountering errors during the HSIC pinctrl handling section the regulator should be disabled.
After the above-stated changes it is possible to jump onto "disable_hsic_regulator" label without having added the CPU latency QoS request previously. This would result in cpu_latency_qos_remove_request() yielding a WARNING.
So rearrange the error handling path to follow the reverse order of different probing phases.
Suggest use devm_add_action() to simple whole error handle code.
I'll try with that in v2 then, thanks for suggestion.
Found by Linux Verification Center (linuxtesting.org).
I think this sentense have not provide valuable informaiton for reader.
Well, that's a line which the organization rules specify to put into every bugfix patch found on its behalf. I must follow these rules.
Btw, you can find this in the changelogs of many other commits existing in the main kernel tree:
$ git shortlog --grep="linuxtesting.org" --group=format:"" (859): kernel/range.c: fix clean_sort_range() for the case of full array Staging: pohmelfs/dir.c: Remove unneeded mutex_unlock() from pohmelfs_rename() USB: usb-gadget: unlock data->lock mutex on error path in ep_read() ...
Frank
Fixes: 4d6141288c33 ("usb: chipidea: imx: pinctrl for HSIC is optional") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin pchelkin@ispras.ru
drivers/usb/chipidea/ci_hdrc_imx.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 619779eef333..3f11ae071c7f 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -407,13 +407,13 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) "pinctrl_hsic_idle lookup failed, err=%ld\n", PTR_ERR(pinctrl_hsic_idle)); ret = PTR_ERR(pinctrl_hsic_idle);
goto err_put;
goto disable_hsic_regulator;
}
ret = pinctrl_select_state(data->pinctrl, pinctrl_hsic_idle); if (ret) { dev_err(dev, "hsic_idle select failed, err=%d\n", ret);
goto err_put;
goto disable_hsic_regulator;
}
data->pinctrl_hsic_active = pinctrl_lookup_state(data->pinctrl,
@@ -423,7 +423,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) "pinctrl_hsic_active lookup failed, err=%ld\n", PTR_ERR(data->pinctrl_hsic_active)); ret = PTR_ERR(data->pinctrl_hsic_active);
goto err_put;
} }goto disable_hsic_regulator;
@@ -432,11 +432,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
ret = imx_get_clks(dev); if (ret)
goto disable_hsic_regulator;
goto qos_remove_request;
ret = imx_prepare_enable_clks(dev); if (ret)
goto disable_hsic_regulator;
goto qos_remove_request;
ret = clk_prepare_enable(data->clk_wakeup); if (ret)
@@ -526,12 +526,13 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) clk_disable_unprepare(data->clk_wakeup); err_wakeup_clk: imx_disable_unprepare_clks(dev); +qos_remove_request:
- if (pdata.flags & CI_HDRC_PMQOS)
cpu_latency_qos_remove_request(&data->pm_qos_req);
disable_hsic_regulator: if (data->hsic_pad_regulator) /* don't overwrite original ret (cf. EPROBE_DEFER) */ regulator_disable(data->hsic_pad_regulator);
- if (pdata.flags & CI_HDRC_PMQOS)
data->ci_pdev = NULL;cpu_latency_qos_remove_request(&data->pm_qos_req);
err_put: if (data->usbmisc_data) -- 2.48.1