From: Lee Jones <lee@kernel.org>
To: Thomas Richard <thomas.richard@bootlin.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
Andreas Kemnade <andreas@kemnade.info>,
Kevin Hilman <khilman@baylibre.com>,
Roger Quadros <rogerq@kernel.org>,
Tony Lindgren <tony@atomide.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 06/11] mfd: omap-usb-host: Sanitize error path in the probe()
Date: Wed, 29 Apr 2026 12:58:24 +0100 [thread overview]
Message-ID: <20260429115824.GB1806155@google.com> (raw)
In-Reply-To: <20260330-omap4-fix-usb-support-v2-6-1c1e11b190dc@bootlin.com>
On Mon, 30 Mar 2026, Thomas Richard wrote:
> Use dev_err_probe() to simplify the code and standardize the error output.
> Remove -ENOMEM messages, there's already enough output.
>
> Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
> ---
> drivers/mfd/omap-usb-host.c | 81 +++++++++++++++++++--------------------------
> 1 file changed, 34 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index 4e066a17cef0..ac974285be34 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -546,22 +546,17 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> dev->platform_data = pdata;
> }
>
> - if (!pdata) {
> - dev_err(dev, "Missing platform data\n");
> - return -ENODEV;
> - }
> + if (!pdata)
> + return dev_err_probe(dev, -ENODEV, "Missing platform data\n");
>
> - if (pdata->nports > OMAP3_HS_USB_PORTS) {
> - dev_info(dev, "Too many num_ports <%d> in platform_data. Max %d\n",
> - pdata->nports, OMAP3_HS_USB_PORTS);
> - return -ENODEV;
> - }
> + if (pdata->nports > OMAP3_HS_USB_PORTS)
> + return dev_err_probe(dev, -ENODEV,
> + "Too many num_ports <%d> in platform_data. Max %d\n",
> + pdata->nports, OMAP3_HS_USB_PORTS);
>
> omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
> - if (!omap) {
> - dev_err(dev, "Memory allocation failed\n");
> + if (!omap)
> return -ENOMEM;
> - }
>
> omap->uhh_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(omap->uhh_base))
> @@ -614,7 +609,6 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> omap->hsic60m_clk = devm_kzalloc(dev, i, GFP_KERNEL);
>
> if (!omap->utmi_clk || !omap->hsic480m_clk || !omap->hsic60m_clk) {
> - dev_err(dev, "Memory allocation failed\n");
> ret = -ENOMEM;
> goto err_mem;
> }
> @@ -648,9 +642,8 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> omap->ehci_logic_fck = devm_clk_get(dev,
> "usbhost_120m_fck");
> if (IS_ERR(omap->ehci_logic_fck)) {
> - ret = PTR_ERR(omap->ehci_logic_fck);
> - dev_err(dev, "usbhost_120m_fck failed:%d\n",
> - ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->ehci_logic_fck),
> + "usbhost_120m_fck failed\n");
Can we take this opportunity to make this a bit more user friendly?
"Failed to get usbhost_120m_fck clock
Same throughout please.
> goto err_mem;
> }
> }
> @@ -660,36 +653,36 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> /* for OMAP4+ i.e. USBHS REV2+ */
> omap->utmi_p1_gfclk = devm_clk_get(dev, "utmi_p1_gfclk");
> if (IS_ERR(omap->utmi_p1_gfclk)) {
> - ret = PTR_ERR(omap->utmi_p1_gfclk);
> - dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->utmi_p1_gfclk),
> + "utmi_p1_gfclk failed error\n");
> goto err_mem;
> }
>
> omap->utmi_p2_gfclk = devm_clk_get(dev, "utmi_p2_gfclk");
> if (IS_ERR(omap->utmi_p2_gfclk)) {
> - ret = PTR_ERR(omap->utmi_p2_gfclk);
> - dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->utmi_p2_gfclk),
> + "utmi_p2_gfclk failed error\n");
> goto err_mem;
> }
>
> omap->xclk60mhsp1_ck = devm_clk_get(dev, "refclk_60m_ext_p1");
> if (IS_ERR(omap->xclk60mhsp1_ck)) {
> - ret = PTR_ERR(omap->xclk60mhsp1_ck);
> - dev_err(dev, "refclk_60m_ext_p1 failed error:%d\n", ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->xclk60mhsp1_ck),
> + "refclk_60m_ext_p1 failed error\n");
> goto err_mem;
> }
>
> omap->xclk60mhsp2_ck = devm_clk_get(dev, "refclk_60m_ext_p2");
> if (IS_ERR(omap->xclk60mhsp2_ck)) {
> - ret = PTR_ERR(omap->xclk60mhsp2_ck);
> - dev_err(dev, "refclk_60m_ext_p2 failed error:%d\n", ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->xclk60mhsp2_ck),
> + "refclk_60m_ext_p2 failed error\n");
> goto err_mem;
> }
>
> omap->init_60m_fclk = devm_clk_get(dev, "refclk_60m_int");
> if (IS_ERR(omap->init_60m_fclk)) {
> - ret = PTR_ERR(omap->init_60m_fclk);
> - dev_err(dev, "refclk_60m_int failed error:%d\n", ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->init_60m_fclk),
> + "refclk_60m_int failed error\n");
> goto err_mem;
> }
>
> @@ -706,9 +699,9 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> */
> omap->utmi_clk[i] = devm_clk_get(dev, clkname);
> if (IS_ERR(omap->utmi_clk[i])) {
> - ret = PTR_ERR(omap->utmi_clk[i]);
> - dev_err(dev, "Failed to get clock : %s : %d\n",
> - clkname, ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->utmi_clk[i]),
> + "Failed to get clock : %s\n",
> + clkname);
> goto err_mem;
> }
>
> @@ -716,9 +709,9 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> "usb_host_hs_hsic480m_p%d_clk", i + 1);
> omap->hsic480m_clk[i] = devm_clk_get(dev, clkname);
> if (IS_ERR(omap->hsic480m_clk[i])) {
> - ret = PTR_ERR(omap->hsic480m_clk[i]);
> - dev_err(dev, "Failed to get clock : %s : %d\n",
> - clkname, ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->hsic480m_clk[i]),
> + "Failed to get clock : %s\n",
> + clkname);
> goto err_mem;
> }
>
> @@ -726,9 +719,9 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> "usb_host_hs_hsic60m_p%d_clk", i + 1);
> omap->hsic60m_clk[i] = devm_clk_get(dev, clkname);
> if (IS_ERR(omap->hsic60m_clk[i])) {
> - ret = PTR_ERR(omap->hsic60m_clk[i]);
> - dev_err(dev, "Failed to get clock : %s : %d\n",
> - clkname, ret);
> + ret = dev_err_probe(dev, PTR_ERR(omap->hsic60m_clk[i]),
> + "Failed to get clock : %s\n",
> + clkname);
> goto err_mem;
> }
> }
> @@ -737,16 +730,14 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> ret = clk_set_parent(omap->utmi_p1_gfclk,
> omap->xclk60mhsp1_ck);
> if (ret != 0) {
> - dev_err(dev, "xclk60mhsp1_ck set parent failed: %d\n",
> - ret);
> + dev_err_probe(dev, ret, "xclk60mhsp1_ck set parent failed\n");
> goto err_mem;
> }
> } else if (is_ehci_tll_mode(pdata->port_mode[0])) {
> ret = clk_set_parent(omap->utmi_p1_gfclk,
> omap->init_60m_fclk);
> if (ret != 0) {
> - dev_err(dev, "P0 init_60m_fclk set parent failed: %d\n",
> - ret);
> + dev_err_probe(dev, ret, "P0 init_60m_fclk set parent failed\n");
> goto err_mem;
> }
> }
> @@ -755,16 +746,14 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> ret = clk_set_parent(omap->utmi_p2_gfclk,
> omap->xclk60mhsp2_ck);
> if (ret != 0) {
> - dev_err(dev, "xclk60mhsp2_ck set parent failed: %d\n",
> - ret);
> + dev_err_probe(dev, ret, "xclk60mhsp2_ck set parent failed\n");
> goto err_mem;
> }
> } else if (is_ehci_tll_mode(pdata->port_mode[1])) {
> ret = clk_set_parent(omap->utmi_p2_gfclk,
> omap->init_60m_fclk);
> if (ret != 0) {
> - dev_err(dev, "P1 init_60m_fclk set parent failed: %d\n",
> - ret);
> + dev_err_probe(dev, ret, "P1 init_60m_fclk set parent failed\n");
> goto err_mem;
> }
> }
> @@ -775,17 +764,15 @@ static int usbhs_omap_probe(struct platform_device *pdev)
> if (dev->of_node) {
> ret = of_platform_populate(dev->of_node,
> usbhs_child_match_table, NULL, dev);
> -
> if (ret) {
> - dev_err(dev, "Failed to create DT children: %d\n", ret);
> + dev_err_probe(dev, ret, "Failed to create DT children\n");
> goto err_mem;
> }
>
> } else {
> ret = omap_usbhs_alloc_children(pdev);
> if (ret) {
> - dev_err(dev, "omap_usbhs_alloc_children failed: %d\n",
> - ret);
> + dev_err_probe(dev, ret, "omap_usbhs_alloc_children failed\n");
We certainly don't want to mention function names.
> goto err_mem;
> }
> }
>
> --
> 2.53.0
>
--
Lee Jones
next prev parent reply other threads:[~2026-04-29 11:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 13:43 [PATCH v2 00/11] Add SIM pbias regulator support for USB on OMAP4 Thomas Richard
2026-03-30 13:43 ` [PATCH v2 01/11] dt-bindings: regulator: ti,pbias-regulator: Convert to DT schema Thomas Richard
2026-03-31 8:21 ` Krzysztof Kozlowski
2026-04-08 7:57 ` Thomas Richard
2026-04-08 12:38 ` Rob Herring
2026-03-30 13:43 ` [PATCH v2 02/11] dt-bindings: regulator: ti,pbias-regulator: Add pbias_sim_omap4 regulator Thomas Richard
2026-03-31 8:22 ` Krzysztof Kozlowski
2026-04-08 7:58 ` Thomas Richard
2026-04-08 12:41 ` Rob Herring
2026-04-08 13:01 ` Thomas Richard
2026-03-30 13:44 ` [PATCH v2 03/11] regulator: pbias: Add pbias SIM regulator for OMAP4 Thomas Richard
2026-03-30 13:44 ` [PATCH v2 04/11] ARM: dts: ti: omap4: Add pbias SIM regulator Thomas Richard
2026-03-30 13:44 ` [PATCH v2 05/11] mfd: omap-usb-host: Cleanup header includes Thomas Richard
2026-03-30 13:44 ` [PATCH v2 06/11] mfd: omap-usb-host: Sanitize error path in the probe() Thomas Richard
2026-04-29 11:58 ` Lee Jones [this message]
2026-03-30 13:44 ` [PATCH v2 07/11] mfd: omap-usb-host: Refactor suspend and resume callbacks Thomas Richard
2026-04-29 12:59 ` Lee Jones
2026-03-30 13:44 ` [PATCH v2 08/11] dt-bindings: mfd: ti,omap-usb-host: Convert to DT schema Thomas Richard
2026-04-08 12:55 ` Rob Herring
2026-03-30 13:44 ` [PATCH v2 09/11] dt-bindings: mfd: ti,omap-usb-host: Add 'pbias-supply' property Thomas Richard
2026-03-30 16:40 ` Thomas Richard
2026-03-30 13:44 ` [PATCH v2 10/11] mfd: omap-usb-host: Add pbias regulator support Thomas Richard
2026-04-29 13:06 ` Lee Jones
2026-03-30 13:44 ` [PATCH v2 11/11] ARM: dts: ti: omap4: Add pbias regulator to the HS USB Host Thomas Richard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260429115824.GB1806155@google.com \
--to=lee@kernel.org \
--cc=aaro.koskinen@iki.fi \
--cc=andreas@kemnade.info \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=khilman@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=thomas.richard@bootlin.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox