From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A95BF1487F4; Tue, 30 Sep 2025 15:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759245011; cv=none; b=hS+mLrWSCK2qPp7biZIoio7O+J4AiZj9SKialo4RvL+50kaqyqyWDqFgbSbrHT0HuXx+/OSdi4llg9504dwc/FRbe4iXbFguj54MJo33g6GOiH46oYIHN2t421IabgXDH3a4bxEc+Twe9Spj0Wq70HS0fBLdC0iMkMGnfVI3tX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759245011; c=relaxed/simple; bh=UgtwjfP9nNvmyRNON0VHq2UxSzE60EVEc4ISUPXvAWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FPiePzVI9PQx0GeZVOwxE/X3ddrSIQVjE0Rh8jTcuPetl7WMHuIybqXKV91kXX7Q+Xup+JWfJ3gAyOIytkOef7a1cwvcWjyjAiedgJkWWSU4joREXYZC2Jqjda1Nxr5Eg0k6u3+Hf8GBwNS35wzh9jDM9iA/18UFRvf+kWwwXk4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=D5gopSMn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="D5gopSMn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FE8DC4CEF0; Tue, 30 Sep 2025 15:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759245011; bh=UgtwjfP9nNvmyRNON0VHq2UxSzE60EVEc4ISUPXvAWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D5gopSMnkHANm5vivLm8jdpotDwcIlywbYfjgWhjAKHIgrqxrtEyv8ySJkMYWuuv0 vVcWwg9a6ABiyZybQkvJRt/Sl2QHVwNN0PilIi07FkjgQql6TrhMlT56BK/ykqV/iX Dr3q//WiKBYJAIaCiuTMkKDcLTjv+8a6Gtyhadpw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stefan Wahren , Christoph Niedermaier , Richard Leitner , Simon Horman , Wei Fang , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 038/151] net: fec: Fix possible NPD in fec_enet_phy_reset_after_clk_enable() Date: Tue, 30 Sep 2025 16:46:08 +0200 Message-ID: <20250930143829.128370653@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143827.587035735@linuxfoundation.org> References: <20250930143827.587035735@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Wahren [ Upstream commit 03e79de4608bdd48ad6eec272e196124cefaf798 ] The function of_phy_find_device may return NULL, so we need to take care before dereferencing phy_dev. Fixes: 64a632da538a ("net: fec: Fix phy_device lookup for phy_reset_after_clk_enable()") Signed-off-by: Stefan Wahren Cc: Christoph Niedermaier Cc: Richard Leitner Reviewed-by: Simon Horman Reviewed-by: Wei Fang Link: https://patch.msgid.link/20250904091334.53965-1-wahrenst@gmx.net Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fec_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 437e72110ab54..d457af64f8357 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2033,7 +2033,8 @@ static void fec_enet_phy_reset_after_clk_enable(struct net_device *ndev) */ phy_dev = of_phy_find_device(fep->phy_node); phy_reset_after_clk_enable(phy_dev); - put_device(&phy_dev->mdio.dev); + if (phy_dev) + put_device(&phy_dev->mdio.dev); } } -- 2.51.0