Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3389469pxb; Mon, 17 Jan 2022 19:23:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJykqZVJE2YfGAJBYXQce3ooanjc3yxOwDHf7fvTN/HIwUeJwwco2mAz3RetQD5kzFH7NmgR X-Received: by 2002:a63:f545:: with SMTP id e5mr1864192pgk.237.1642476206333; Mon, 17 Jan 2022 19:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642476206; cv=none; d=google.com; s=arc-20160816; b=QUGtUzuO4qG/WdrC2ow0TSj9BXkZCH9jClltRo9PWCPq9ykgk7ZBs0TlMcElClb6Rw +Thuf5to9JKwpwk+CkZ2wiV+tVbRdebVhV/5FoKhB+ZXHjdo0XZVfXHBCtV0wq0mp4Aj is0Mqn5MV71MjQYAAT8xWWNJzZy4ywsvdpVIHACZB4TpUCjZeV/ISGVteBCM9w+dNm99 5tH2fenynNcjoT10b0ZzVUsRg+8Q3B2HFqocohvSblutADdaWONFnPlFzVzMxLGS9vHW a4BZSUxTbXX498kjgRvIkvbP+rCXJC3Y5nRnfQAWjxxDIvcXXQ+8iaiUtPrYEeqLLaEd 1X+w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RLHQV9BdcHbOn7wABhxdmP5W08pGimp6Nf2Oz2logd8=; b=hS/Kew/OtUQyDYI72fSI5B671p6iz5k7WmOIV2hoyjL4MNC1SkwzvTyRYZvD5rggBW 4hiDRrdxNm11t/vpWvF7/QGu8Vc7VRt0r/PakXI8YpO32GMp71AzYxauswWZKqylprZv RuNFYmx0cyFSL6y67pzPzOwtmBoqZq1xSiyHLDr/ADQOqX0n5YyAURxAuEmIm5SsEXRc GdqYl8VITcPYxq6OAuzfGJrf+QaNyXEwvbk1JDsI9RCl/p/pW2lJ6xv4LEkp07hfK+iT sZYVlKNrqaIQA7InhhjlR3t+29FWyc4rEiUCJ5VcoVuaIo+XNkfsfE6efKmIsDP54Y6e ThTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VF+M80OA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t20si15918847pgk.144.2022.01.17.19.23.14; Mon, 17 Jan 2022 19:23:26 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VF+M80OA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345964AbiARCcS (ORCPT + 99 others); Mon, 17 Jan 2022 21:32:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37908 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245286AbiARCZP (ORCPT ); Mon, 17 Jan 2022 21:25:15 -0500 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 A7569B81243; Tue, 18 Jan 2022 02:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B324C36AE3; Tue, 18 Jan 2022 02:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472713; bh=LmPaX7zldt4EKMoSEVIJLQiC2qrMN8IKsWAukZL/DfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VF+M80OAR2j0IRLSqaG537Sp/LXgMeuUtKOHeYbDTAQh78lTyuc9fHYAYSd8tDzU+ hXCJ5pCFVfrfpnnFJ7z0+K1R4YiTpqfXM4SHwhAnFwrmFWw42Bucggu0QFRDg54pVy hWq+9LS5RLdKlIbOBga0ODdQnmQmag42zHDDVbCjN9J6EWJ8V1NKjRs8DUIDlfYCCI PdbfqE/k+xjGIFgkqG8moU0DtIKPeQBcNlbRYVfnNuoKLz+8zesAxU/xAlE8cAeU65 EkcK5YE0Eau0JaAI8xrJ9rzmXtxdE1Wwy5pJe8o0tbI2TvIr7bAAGr/isfpDOJNYGc QjA58Lz5GUdpQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Colin Foster , Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Sasha Levin , claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, vivien.didelot@gmail.com, davem@davemloft.net, linux@armlinux.org.uk, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 108/217] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices Date: Mon, 17 Jan 2022 21:17:51 -0500 Message-Id: <20220118021940.1942199-108-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Foster [ Upstream commit 49af6a7620c53b779572abfbfd7778e113154330 ] Existing felix devices all have an initialized pcs array. Future devices might not, so running a NULL check on the array before dereferencing it will allow those future drivers to not crash at this point Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/dsa/ocelot/felix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index f1a05e7dc8181..221440a61e17e 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -823,7 +823,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, struct felix *felix = ocelot_to_felix(ocelot); struct dsa_port *dp = dsa_to_port(ds, port); - if (felix->pcs[port]) + if (felix->pcs && felix->pcs[port]) phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); } -- 2.34.1