From patchwork Tue Aug 10 06:35:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wong Vee Khee X-Patchwork-Id: 12428065 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86E68C4338F for ; Tue, 10 Aug 2021 06:29:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 629BE61052 for ; Tue, 10 Aug 2021 06:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236664AbhHJGaL (ORCPT ); Tue, 10 Aug 2021 02:30:11 -0400 Received: from mga11.intel.com ([192.55.52.93]:31713 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234701AbhHJGaJ (ORCPT ); Tue, 10 Aug 2021 02:30:09 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10070"; a="211738411" X-IronPort-AV: E=Sophos;i="5.84,309,1620716400"; d="scan'208";a="211738411" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2021 23:29:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,309,1620716400"; d="scan'208";a="671561223" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 09 Aug 2021 23:29:46 -0700 Received: from glass.png.intel.com (glass.png.intel.com [10.158.65.69]) by linux.intel.com (Postfix) with ESMTP id 66BD558090A; Mon, 9 Aug 2021 23:29:44 -0700 (PDT) From: Wong Vee Khee To: Vladimir Oltean , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Vladimir Oltean Subject: [PATCH net 1/1] net: dsa: sja1105: fix error handling on NULL returned by xpcs_create() Date: Tue, 10 Aug 2021 14:35:13 +0800 Message-Id: <20210810063513.1757614-1-vee.khee.wong@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There is a possibility xpcs_create() returned a NULL and this is not handled properly in the sja1105 driver. Fixed this by using IS_ERR_ON_NULL() instead of IS_ERR(). Fixes: 3ad1d171548e ("net: dsa: sja1105: migrate to xpcs for SGMII") Cc: Vladimir Olten Signed-off-by: Wong Vee Khee --- drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c index 19aea8fb76f6..2c69a759ce6e 100644 --- a/drivers/net/dsa/sja1105/sja1105_mdio.c +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c @@ -438,7 +438,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv) } xpcs = xpcs_create(mdiodev, priv->phy_mode[port]); - if (IS_ERR(xpcs)) { + if (IS_ERR_OR_NULL(xpcs)) { rc = PTR_ERR(xpcs); goto out_pcs_free; }