From patchwork Fri Nov 19 22:43:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629657 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8898FC433F5 for ; Fri, 19 Nov 2021 22:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233938AbhKSWqa (ORCPT ); Fri, 19 Nov 2021 17:46:30 -0500 Received: from mail-co1nam11on2117.outbound.protection.outlook.com ([40.107.220.117]:22881 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231231AbhKSWqa (ORCPT ); Fri, 19 Nov 2021 17:46:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y57LrukPSUZXN682GRucCoWI2i0476pyH8FU6W3tjFJR6mwcP/qPBX/S/141bz1dGZtW+3hyN6tPre36s+chIlaXtSMyLxRISy2PsAoWyKwl0iQp5/Zmr3/kdPy/i7km7vsVs4SY2xn03BuNkJEatG9otxkSs6IsRER8dcPJNOcQyg8UAZp0/VuR/hnkiI7rwcP73Cut9GzvNmnpPudKnRIHjQ5H8tB1T2kepGVqXAdbEPV56E9sLuraca9avKG6gE5OeFPTn/GEzhGUWuzT6FReq683wMe8wk/56FKJzq0k+hVYLOUoxYk7Do+CgwN7KeFsgo1CpSTW+c4+v07GAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m3Zz4d2L95f4U+ta1PckduowNTdDByYB6IOALWxD360=; b=EPpV/XUlgVyk4vfN1WeYdyBjQS4jyE5RqY+hYXkH551AMmkaFbv/g+HDAVEmlScS9COhHEFgwfcOooD/+HIQZwhkDO0pTHgwt8/MZwu4yF6n5m9JLWv7pSvzcmQv674wQFK06EuPoL9OsUuGYcr+Z24zpPqPe6c0QeT7CjvxQ/ICcrhclh9WD9rR9qHiSndYvi453JGwsjlcIjz7D/aXDBWCQrrCgSYUiR/fPf4V3yu3fxLVBYJRiWYsY4Xvfqaq3A27YgjvjCg6N/ZfuKJqff7B7ukCp4Tk/nBBGTSUX1QxMLvGQyQYANAwkAGf7tURbEixao9Xe3j1rjp2lLou7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m3Zz4d2L95f4U+ta1PckduowNTdDByYB6IOALWxD360=; b=iMpHC9bS0PrngnDzraR8smbdRTAlNXUr+ZfMrEE6jfHPKb6/WtbZaviWKeU2WGRuHMvGtzqKvEvuIJWkh6D0+2mukUxNpNojt1WYODT/2danhYlrymIpun0IBvoFnCml1Rb3xHX0QRVm+nig2Wkw+++W9jLO9XRUhLR4CRNZnBw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MW4PR10MB5701.namprd10.prod.outlook.com (2603:10b6:303:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Fri, 19 Nov 2021 22:43:25 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:25 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 2/6] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices Date: Fri, 19 Nov 2021 14:43:09 -0800 Message-Id: <20211119224313.2803941-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02a61b92-4999-4837-3a90-08d9abadff7f X-MS-TrafficTypeDiagnostic: MW4PR10MB5701: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8HNRLawthGhc32LRUZarXA9UQuZneji8uUYSC/xK80TB1x4oGbzptuUp6GBw/gZOfGdwcoVqSvj5T/dWa4pGjbakRfi2ceWKfWemA3J+Jt7NPUuiJmL6sOxQCNAZLvY9B1o2EouVXz5b/TikR9MzGUa8CnPIVosaTynxA1pLXyxV5XDyCo6z7vkBuaOfOFHj8paccwENPboWobAKGqq41Wvr5Emt4zX+6AA0Iw9WU+ZZCbtgo9tRBrxmiHMvje+2DEqYC6Uq241ZDiJDb2jOL8Rpzig+X9d1YBbgzGQDxJSKeiZHrRT8qOmoB8w6B5S0m2bWrR5NKOhcK/lnaLaadqF6DUKT8Ig/EFONB3fzU8a0LSVr9+uIwyUKvlvEpyLfovECU+5hCdGvVvsWWpdOP2w/5MkjDR2t7bBKkDYgYBl8C3dYgG6FomL02pxbivUesWGa57mFE8wmjZbt3tVmhxF0xN5WnsQFrJZxAGNDGUYav56w7Mbieizjx7sm98P+salvMy8Y/nEjvDPNozyEn3I5JL28cavoNvOC135CzjAhy51V4OGsqFOp8sqKUzIoWmbrmCy67kXvvKumB0RmvNroThBd7d+X0+fSA4xevOway/CG/kb6umJKsWScZQ93Bdr4SJV7GKavot5TDuziUjnk4UflsXM8aNdrwnBwt5bZelhGEvA7dN8xgJ/N64ak/Pjaz6NExeIiZWarfoJ5KA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39840400004)(366004)(396003)(136003)(346002)(376002)(316002)(36756003)(44832011)(8936002)(8676002)(6486002)(4326008)(6506007)(508600001)(4744005)(956004)(2616005)(1076003)(7416002)(6512007)(26005)(86362001)(66476007)(66946007)(66556008)(83380400001)(2906002)(38100700002)(52116002)(38350700002)(186003)(54906003)(5660300002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xNwn8ti+dqTu8zKwSm9ZmUZhR6DD+8XW9L69tlJ6f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cNxW31K9iik16tnKrsuaolS1YrpKBUruuRyT65WxGTih3tE/HBPMpEsMlFD7hwBo6G8mkO5ee4vJwrHNQBc1R+Ky1J78fQsVQDO427zkbimcMXPX6ggenA5zaT9j48uKg8R1dmrNfHXBKCpMYZ0bJVub72Tn4MDIUvniqYjGflgZ3/vt9ojWdQJ+ZUETMCCk+yYsOl+1MI/rBSZQKKWZJiPgqzHMdH2XE2H47YZj5WDsuJZbEagzK3PEzxWG0RJeDxOcUeVA33rTVE4ve+YL5iVJS86wh+kmypwQs3SZYacWV8yJkzOHCXKmb2YLPKFMEsycn/0sApMMHcu3aKvGjhvJ8Fyjx7MZuwW+YsV6PRPQWJxq4e6EfKoTb6ntY0mKwjcMXsbtpz6G7oWXl4W+I0GxcENJXAuQWgWR/QSkpu4SYfO+4lrm4U0fm9MVXH6VdLZpvlp7yETm4FL+Ef182N5//r5MYhSUx5TTrLtqmDLG4zqHBsy6s7UTBnYG9amFyvsEjpE+DGWC/6XKJPeQOrONZrpvRobDr6xLH1qIlgfL8z07hW5h/T6WFlOhqyl5ozFRXxhYEaEKBjTE= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02a61b92-4999-4837-3a90-08d9abadff7f X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:25.5345 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QKWFqjTPmscBtSMSYJionEtP3WbUiyTGt1aTn3jpiL668PQP1W/c+L1hasmFDLRJbqDgYUW1KncGB3UFgl67qbgotpskB+t5hTxZlXHmJjE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5701 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 e487143709da..7b42d219545c 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -820,7 +820,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); }