From: Dragan Simic <dsimic@manjaro.org>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org,
linux-phy@lists.infradead.org, vkoul@kernel.org,
kishon@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] phy: phy-rockchip-inno-usb2: Handle failed extcon allocation better
Date: Sat, 17 Aug 2024 08:52:05 +0200 [thread overview]
Message-ID: <93d7cfcf3ce97f22e29cc93241b65bc1@manjaro.org> (raw)
In-Reply-To: <4927264.xgNZFEDtJV@diego>
Hello Heiko,
On 2024-08-15 18:12, Heiko Stübner wrote:
> Am Dienstag, 13. August 2024, 20:38:17 CEST schrieb Dragan Simic:
>> Return the actual error code upon failure to allocate extcon device,
>> instead
>> of hardcoding -ENOMEM. While there, produce an appropriate error
>> message.
>>
>> Signed-off-by: Dragan Simic <dsimic@manjaro.org>
>> ---
>> drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> index 4f71373ae6e1..d33418a1e7a8 100644
>> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> @@ -434,8 +434,10 @@ static int
>> rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
>> edev = devm_extcon_dev_allocate(rphy->dev,
>> rockchip_usb2phy_extcon_cable);
>>
>> - if (IS_ERR(edev))
>> - return -ENOMEM;
>> + if (IS_ERR(edev)) {
>> + dev_err(rphy->dev, "failed to allocate extcon device\n");
>> + return PTR_ERR(edev);
>> + }
>
> maybe even use dev_err_probe?
>
> rockchip_usb2phy_extcon_register() gets called from the probe function,
> so even using it is also sematically correct ;-) .
Good suggestion, thanks! I'll use dev_err_probe() in the v2, albeit it
also calls for turning this into a small patch series that additionally
replaces dev_err() with dev_err_probe() in the rockchip_usb2phy_probe()
function, for consistency. :)
>> ret = devm_extcon_dev_register(rphy->dev, edev);
>> if (ret) {
>>
prev parent reply other threads:[~2024-08-17 6:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 18:38 [PATCH] phy: phy-rockchip-inno-usb2: Handle failed extcon allocation better Dragan Simic
2024-08-15 16:12 ` Heiko Stübner
2024-08-17 6:52 ` Dragan Simic [this message]
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=93d7cfcf3ce97f22e29cc93241b65bc1@manjaro.org \
--to=dsimic@manjaro.org \
--cc=heiko@sntech.de \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=vkoul@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