From nobody Tue Dec 2 00:25:48 2025 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735952FBE08 for ; Mon, 24 Nov 2025 10:58:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763981910; cv=none; b=IbD0WtJpyySHjf8GRtl4RlWysQFTaFXc3EFpcBMRdhL11ebWaTC7ngcXcrxLQM1RkRwP2dWirX2bNK6lb+T3h9rnib3yTv0Qdh8yIXzUzm/zIdC+5kpK4jdXzlFoRsD/x3HHDR2IzBCARJiZ6AoqoTu2m+gHzJLdrQfPnH3UomY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763981910; c=relaxed/simple; bh=hGyPZSV0cMkaUbL1kkUN1PoxbEqj+shz6/sCHKA4iEA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bLIkaWqO0RVJYLRkV6xqziKEJNYa6ab33AkL/HUL5xEVwopA7+UZaB36EmeZoFjVyj7YszM64mQ2d29bANndA6o/8ElR2YeuiiY7xN1HiVP5U+rM07lrUZfjn9wIzKbHxW8UKirT251FEVhP7ENKv4YCu2oaJQVCw4aNY49VEXc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from DESKTOP-L0HPE2S (unknown [124.16.141.245]) by APP-01 (Coremail) with SMTP id qwCowAAXrs1LOiRpFD_cAQ--.612S2; Mon, 24 Nov 2025 18:58:19 +0800 (CST) From: Haotian Zhang To: vkoul@kernel.org, kishon@kernel.org, neil.armstrong@linaro.org Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Haotian Zhang Subject: [PATCH v2] phy: ti: da8xx-usb: Handle devm_pm_runtime_enable() errors Date: Mon, 24 Nov 2025 18:57:34 +0800 Message-ID: <20251124105734.1027-1-vulab@iscas.ac.cn> X-Mailer: git-send-email 2.50.1.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qwCowAAXrs1LOiRpFD_cAQ--.612S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KryUWr45Zw13Ww4UZryxXwb_yoW8Cw17pF WrWas29rWrK348Gw4UJrsruFW3Cw15tryxKF97C3WF9a45G3y8Xa45AFyjvFsYvrykCF15 J3WrXF47Aa12yF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkF7I0En4kS14v26r12 6r1DMxkIecxEwVAFwVW8twCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2 jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0x ZFpf9x0JUIoGdUUUUU= X-CM-SenderInfo: pyxotu46lvutnvoduhdfq/1tbiDAYQA2kkAizTxQAAss Content-Type: text/plain; charset="utf-8" devm_pm_runtime_enable() can fail due to memory allocation. The current code ignores its return value after calling pm_runtime_set_active(), leaving the device in an inconsistent state if runtime PM initialization fails. Check the return value of devm_pm_runtime_enable() and return on failure. Also move the declaration of 'ret' to the function scope to support this check. Fixes: ee8e41b5044f ("phy: ti: phy-da8xx-usb: Add runtime PM support") Suggested-by: Neil Armstrong Signed-off-by: Haotian Zhang Reviewed-by: Neil Armstrong --- Changes in v2: -Just return ret and drop the dev_err() as suggested by Neil Armstrong. --- drivers/phy/ti/phy-da8xx-usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/phy/ti/phy-da8xx-usb.c b/drivers/phy/ti/phy-da8xx-usb.c index 1d81a1e6ec6b..62fa6f89c0e6 100644 --- a/drivers/phy/ti/phy-da8xx-usb.c +++ b/drivers/phy/ti/phy-da8xx-usb.c @@ -180,6 +180,7 @@ static int da8xx_usb_phy_probe(struct platform_device *= pdev) struct da8xx_usb_phy_platform_data *pdata =3D dev->platform_data; struct device_node *node =3D dev->of_node; struct da8xx_usb_phy *d_phy; + int ret; =20 d_phy =3D devm_kzalloc(dev, sizeof(*d_phy), GFP_KERNEL); if (!d_phy) @@ -233,8 +234,6 @@ static int da8xx_usb_phy_probe(struct platform_device *= pdev) return PTR_ERR(d_phy->phy_provider); } } else { - int ret; - ret =3D phy_create_lookup(d_phy->usb11_phy, "usb-phy", "ohci-da8xx"); if (ret) @@ -249,7 +248,9 @@ static int da8xx_usb_phy_probe(struct platform_device *= pdev) PHY_INIT_BITS, PHY_INIT_BITS); =20 pm_runtime_set_active(dev); - devm_pm_runtime_enable(dev); + ret =3D devm_pm_runtime_enable(dev); + if (ret) + return ret; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. --=20 2.50.1.windows.1