From: Matthias Brugger <matthias.bgg@gmail.com>
To: Lin Ruifeng <linruifeng4@huawei.com>,
b-liu@ti.com, gregkh@linuxfoundation.org,
angelogioacchino.delregno@collabora.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH -next v2] usb: musb: mediatek: Simplify code with dev_err_probe()
Date: Mon, 9 Sep 2024 13:05:58 +0200 [thread overview]
Message-ID: <f623afa8-7c5a-44c5-be63-199a06ddbcfc@gmail.com> (raw)
In-Reply-To: <20240907081351.19879-1-linruifeng4@huawei.com>
On 07/09/2024 10:13, Lin Ruifeng wrote:
> The combination of dev_err() and the returned error code could be
> replaced by dev_err_probe() in driver's probe function. Let's,
> converting to dev_err_probe() to make code more simple.
>
> Signed-off-by: Lin Ruifeng <linruifeng4@huawei.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
> v2:
> - The wrong message is modified.
> drivers/usb/musb/mediatek.c | 27 +++++++++++----------------
> 1 file changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> index 0a35aab3ab81..63c86c046b98 100644
> --- a/drivers/usb/musb/mediatek.c
> +++ b/drivers/usb/musb/mediatek.c
> @@ -416,10 +416,9 @@ static int mtk_musb_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> ret = of_platform_populate(np, NULL, NULL, dev);
> - if (ret) {
> - dev_err(dev, "failed to create child devices at %p\n", np);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to create child devices at %p\n", np);
>
> ret = mtk_musb_clks_get(glue);
> if (ret)
> @@ -448,23 +447,19 @@ static int mtk_musb_probe(struct platform_device *pdev)
> glue->role = USB_ROLE_NONE;
> break;
> default:
> - dev_err(&pdev->dev, "Error 'dr_mode' property\n");
> - return -EINVAL;
> + return dev_err_probe(&pdev->dev, -EINVAL,
> + "Error 'dr_mode' property\n");
> }
>
> glue->phy = devm_of_phy_get_by_index(dev, np, 0);
> - if (IS_ERR(glue->phy)) {
> - dev_err(dev, "fail to getting phy %ld\n",
> - PTR_ERR(glue->phy));
> - return PTR_ERR(glue->phy);
> - }
> + if (IS_ERR(glue->phy))
> + return dev_err_probe(dev, PTR_ERR(glue->phy),
> + "fail to getting phy\n");
>
> glue->usb_phy = usb_phy_generic_register();
> - if (IS_ERR(glue->usb_phy)) {
> - dev_err(dev, "fail to registering usb-phy %ld\n",
> - PTR_ERR(glue->usb_phy));
> - return PTR_ERR(glue->usb_phy);
> - }
> + if (IS_ERR(glue->usb_phy))
> + return dev_err_probe(dev, PTR_ERR(glue->usb_phy),
> + "fail to registering usb-phy\n");
>
> glue->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
> if (IS_ERR(glue->xceiv)) {
next prev parent reply other threads:[~2024-09-09 11:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-07 8:13 [PATCH -next v2] usb: musb: mediatek: Simplify code with dev_err_probe() Lin Ruifeng
2024-09-09 9:29 ` Guoqing Jiang
2024-09-09 11:05 ` Matthias Brugger [this message]
2024-09-11 7:48 ` AngeloGioacchino Del Regno
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=f623afa8-7c5a-44c5-be63-199a06ddbcfc@gmail.com \
--to=matthias.bgg@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=b-liu@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linruifeng4@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
/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