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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9327EC433F5 for ; Mon, 3 Jan 2022 14:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234445AbiACOal (ORCPT ); Mon, 3 Jan 2022 09:30:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233984AbiACO2u (ORCPT ); Mon, 3 Jan 2022 09:28:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C63D5C0698CC; Mon, 3 Jan 2022 06:28:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8FA67B80EF6; Mon, 3 Jan 2022 14:28:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5647C36AED; Mon, 3 Jan 2022 14:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1641220117; bh=JxAtgyTmuzCfl0w4z4pXOdJVaL/CBNZx59OHq1h2rhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipotp/LDrCeHGK9X4LYryVn9eim5PRIODaWsOoIQmGwhI5ZyaeYJ2GsJBU8WowaUs /aL+96EFuRGrFISBU+P5MgUqKc9o/GIp9dgUW1WINobdMVSEd+XRQ77K9i4ROFtpWh bwJ2n/jIXXhDxC+bJXSeDhuXdxPzF+lziZG5doA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 16/48] net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register Date: Mon, 3 Jan 2022 15:23:53 +0100 Message-Id: <20220103142054.022601930@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220103142053.466768714@linuxfoundation.org> References: <20220103142053.466768714@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miaoqian Lin [ Upstream commit b45396afa4177f2b1ddfeff7185da733fade1dc3 ] The fixed_phy_get_gpiod function() returns NULL, it doesn't return error pointers, using NULL checking to fix this.i Fixes: 5468e82f7034 ("net: phy: fixed-phy: Drop GPIO from fixed_phy_add()") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20211224021500.10362-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/phy/fixed_phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index 18d81f43f2a88..dd30a6883a027 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c @@ -239,8 +239,8 @@ static struct phy_device *__fixed_phy_register(unsigned int irq, /* Check if we have a GPIO associated with this fixed phy */ if (!gpiod) { gpiod = fixed_phy_get_gpiod(np); - if (IS_ERR(gpiod)) - return ERR_CAST(gpiod); + if (!gpiod) + return ERR_PTR(-EINVAL); } /* Get the next available PHY address, up to PHY_MAX_ADDR */ -- 2.34.1