Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3360799pxt; Tue, 10 Aug 2021 01:34:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxYuNFu5kIuT+qfl+HPp0WNdWQKiO4vxjak0FfYXvIXpNT4KCUvLhIk0IoClp+UN0memJW X-Received: by 2002:a5d:8611:: with SMTP id f17mr128619iol.153.1628584499446; Tue, 10 Aug 2021 01:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628584499; cv=none; d=google.com; s=arc-20160816; b=oJIwpviRVol4HlLc3xwDz7I+cgs6KF/idxVPqTjBcG8OXUxKP9jPaBSI5UTrjlCV6p O62lv4B6lMQb7Hjk4anqlr1ZFQjvSygup2v3i/Bb/0t83kL9tQZGecVnXT2KBfcYO+Dl a5Uq5CNNVG3JHBjLGDJ3o0PBFPCh3u3f5iIdJDz+OO8qqK/ZXvcAIbu8oqEnfTdaEUwg X+F0fz5t7TI16GPQWVPdftWpWK3QmLp5uOYDXNGOxl/Ld8DUjoUhM7RRXenxILLIJ8Ks Yf3MC4gSPiqT3dCRV4V7byRc8c/VBHZyTqHd6bdm9hDvP/ZVKrLi13sFIcY/sVUQym2c bDDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=aIyGpwKoXpr0EJTTzTKLoNYJsi0LbdeOz+KccBjwoIk=; b=gRgVBFixKgeQMJQO7Q3YusGsOX/DqzaokF9MOklDQsHptdfOp2LczMit9VlSfk6+30 OtzJS/0f9VHIMOA28BUgOMW6vH2MCACWfUUKf6yu9oIeNVuQf0ODpBJEksyCxNxfm86A qiSbLboE+i5BmS3H6xOMSgbgxXecZzdmRaRsBehtbVU0FdZ1Yjx3+RdxowL6UfiCtcB2 JOPNo5RwoWpbkRx545tNjKNBFgMB6Awy2Wo3Nrfl0Aje8iq5ql5dzmrLHX/PqvBxpoAQ EAvDcHLJqZtO3hTspWBo0nQCVzre+1rMLeG+TT3jo0umHsKQImrXaY7TB7AtzLx+Lpzg /u8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si19872037ilg.55.2021.08.10.01.34.45; Tue, 10 Aug 2021 01:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236618AbhHJGaL (ORCPT + 99 others); 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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; } -- 2.25.1