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 A8CBDC433EF for ; Tue, 18 Jan 2022 02:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345198AbiARCi1 (ORCPT ); Mon, 17 Jan 2022 21:38:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44883 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245697AbiARCgX (ORCPT ); Mon, 17 Jan 2022 21:36:23 -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 F072BB81235; Tue, 18 Jan 2022 02:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69EE2C36AE3; Tue, 18 Jan 2022 02:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642473380; bh=5TKGjYZF/0sSNgit4j+Xa+PtizIl2rZCLXH/GcNoZ00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWfu4rOCCZHdkhXDrBwgaHKS2YFkhIdvidQNi69wd1zYx3zLsyrMoeBgA+xix6bI/ o9rZZoTqdJeDOOiqgIEhMF7ebl7mxCCziGjoGxSBlIBhy3kdzKXkkK7+NChUuR2v7x vtLHbKeK5eLTr3IU67MeItXiTRBLIGOpaGTXG9vG9uG7JdBqj19iJMFwFuJYTo2ANe l/qN2DczEpKkGCyPmrMLTFe0wg38n/jALJYEezoCG5lpBIma+tUnHj3v7/eMYLN/vq FLKUG6q9HlDv6EujIJEf+SICToyJ+jXq7s/6IKaYoYcwCd18j86KcmFpKYZ8TkcqEl TVGhJeERJAJPw== 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.15 093/188] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices Date: Mon, 17 Jan 2022 21:30:17 -0500 Message-Id: <20220118023152.1948105-93-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118023152.1948105-1-sashal@kernel.org> References: <20220118023152.1948105-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: stable@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 1513dfb523de7..20338d5fa9170 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