From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1519AC52D7D for ; Sat, 17 Aug 2024 06:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6ajXNLehEHAoItRTdTFepO1J4PMhcHWqezEIcekJb2I=; b=YClRX832flRVi1nwKX1gW/KJdW xz2sv2Xz7YD0lCtIF2UZT9ooaMLd6QXVxo200J0hz3KyzYqBOi4vjYtWCiO5QHlIRInu8+AZmdQRX z87ej/+5gytbI1Qodmr3ZHVegeQnyT3CxhdHDKTNFlf7lXMut06eziAdZyvKbZBioBEmSi+yJoY1C Y64R8PV015FTVJ1F62fKeOCr9s31BsU5L3VHP8g3s/6NIhMUqeyYWOdJkgdn7fQ7qSVBbrPDtZJt/ yomgxeRTCXzOmS1b2LzXDkRDL8tiz+8wGaYELvfZrvgC8vAF1ZybSZuETBR09ZgGmoV89xZ2ekOxr ajBXxarA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfDIz-0000000En9G-1xRz; Sat, 17 Aug 2024 06:52:53 +0000 Received: from mail.manjaro.org ([2a01:4f8:c0c:51f3::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfDII-0000000En21-3vsp; Sat, 17 Aug 2024 06:52:12 +0000 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1723877526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6ajXNLehEHAoItRTdTFepO1J4PMhcHWqezEIcekJb2I=; b=BVmxMd9c3smjJUe4ao94yg+XXNmRJ4YiV/fDJ/knlfx+MuDkUFLe7yEOKDBGEzfLkmEW6p hic+wrqBm9wP+cXExok4QqbjYHGeTc/R4V7iUu+sNfD2qZQaRl3VzEnLtl5BVhg8R+qPiA vlZ56OccJlvOQfPitXtcH7gqw3OK72Ih5e7AR93Q7fgiQawWQ65u/7P7ekfOsn9TG8oyGP qUh3j0O4UeM9bGV9piVm8C1wTGBmMcnolY2q6Zzg3tuGvcksmXhhn2BDKxU41cCuSkX0Mb FzTzZboLNL2FAzxZ0pIXtK+2OvsdKbaZMy7hSpOBEp2jnKEi0LxBVjvI04NH+w== Date: Sat, 17 Aug 2024 08:52:05 +0200 From: Dragan Simic To: =?UTF-8?Q?Heiko_St=C3=BCbner?= 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 In-Reply-To: <4927264.xgNZFEDtJV@diego> References: <5fa7796d71e2f46344e972bc98a54539f55b6109.1723551599.git.dsimic@manjaro.org> <4927264.xgNZFEDtJV@diego> Message-ID: <93d7cfcf3ce97f22e29cc93241b65bc1@manjaro.org> X-Sender: dsimic@manjaro.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_235211_473692_27B8D705 X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 >> --- >> 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) { >>