Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp1288430pxb; Fri, 13 Aug 2021 19:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqzjTYtuzfNuzsBEBonRQ2NnmhhzSY97n9ZrTAvslpXwcD/swV9b8RVJzLNu4SU6pSwuJ5 X-Received: by 2002:a05:6638:3804:: with SMTP id i4mr5026930jav.82.1628909501106; Fri, 13 Aug 2021 19:51:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1628909501; cv=pass; d=google.com; s=arc-20160816; b=e++JMRxrXskJ4yhhNejf7hGw9XriGA57uJ0bLfx1PVqd5Zf9Og3owwgdLFMg1VuAVp Oft2dn2Nnqmm10h1HqjNuI26hLaC3HPvkMRA6Fl2W0yEm+EDshid2Jbg2wKYYKlBov62 vJXkZg2i2aMCAxPnjYdzJ7CRmrYzzjtrJvY2xHyFdT03bWTesBIwkYd0X8SoX1R/9dfa GZdtcVjrXr3qrCDM9lbbbhcXump4UGQ32f/61q9gbF3QcZ3fDqGgovFSzf0NDNlILfMn H1ZKIxRADzOisQWIoFFXsqW/6hMO37JmqINWGiPpcsEVSRA5BgIsBGj4vj6ic3SPCSwt 3D+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WiSbwUAFI4oRksMWMywyVIYPBIPT9zbCn5sqw74EWAQ=; b=J4Px9PCR24BeQczH8mqUkickta5eIQROI8ZFg+UYVSl38otjOZgIFbW9k2iEesrivT 2LIRxqGlhpvw3H4554UjczLpNYQ/dgODeCRMJTlY9xY224ppr8o5PYws1Y6TQtXmxBxl 74HwTK1k9Y721JSFx4gJ+v8a9K1ZnGDA09YpSVR1HU9GQMVB1oA41XEaRpUWTvgLuuSv OKYyfrOfQBbDtMm18SwfwN4K/wXnQZs2g7sJ/U7dpQ/Y1+GCm33Kc/+6197NHKESuhPr 8Bbqdk5f1CjRqDHNN3WfrjcCZSu3l3aLXuIDctRsYI8E0sEyC54eUw8aKgAoc6lOPcd3 w5Lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=RTFEb8e9; arc=pass (i=1 spf=pass spfdomain=in-advantage.com dkim=pass dkdomain=in-advantage.com dmarc=pass fromdomain=in-advantage.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=in-advantage.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p6si3896999ilo.37.2021.08.13.19.51.30; Fri, 13 Aug 2021 19:51:41 -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; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=RTFEb8e9; arc=pass (i=1 spf=pass spfdomain=in-advantage.com dkim=pass dkdomain=in-advantage.com dmarc=pass fromdomain=in-advantage.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=in-advantage.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237009AbhHNCvA (ORCPT + 99 others); Fri, 13 Aug 2021 22:51:00 -0400 Received: from mail-bn1nam07on2106.outbound.protection.outlook.com ([40.107.212.106]:65089 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236562AbhHNCuu (ORCPT ); Fri, 13 Aug 2021 22:50:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6d+tuhvQUs5y2D7EnZ0Heh5ZuceFl2j8jgwCJ5iEJkbnP64PeFXUX1pooDl944a/0d08SC8MyjUW5R2DszKiYjPlJyo+OfbOz9aATXpK3jZgYOOWf8E/pc5oYITgaxKhBOwkUdWF0xj89CsZLYCBsl2uvuUlOBp4B3iuPylPvn/kHEB2BsiwzSfjQYkvHh8jU+k7FNqc/41WaUjLv8fO2hXpA9UUGFa1iXbHbqTpmutmY72+ILGQaGId336HtmVa6ORbWNZtf6RHBiDBw1ab3ojD7G7/8htqOr6pKsJQrZ6kqVIY4e40/ilRyXT3Roxjge9rPWFRDbi4OLcj4lIeg== 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-SenderADCheck; bh=WiSbwUAFI4oRksMWMywyVIYPBIPT9zbCn5sqw74EWAQ=; b=jtf3vWGOyfbymWppNtD0ZgXDpu99m7Js1Cys3gaeQ8xW+y4vu7mBLJKs73gcesqZGERQsYhXKmxOHQ9P8lX7L2afxI1wg0t8hNrsALPVUPKK4PxDPqe5JXK+5Zq2yrRLhkDvXsW4ASbrizfQKWsOCju6XZVdC3bjDrQElwyXnCu5hBg9ntzqBxeGWmAf+GrYfIXZdUURBclm1FgR8xlnHS5kyRI+dGg2Meg89QfIf3y6Bhn+eS9VjoF0twPDoSJeKTFQ8BMAIHCS8D+f9SzufQEat15c6aARxjkkWi0+OnBo/GUuTo9w3oSlOiMg4k/PzCqoFMv/gpg9XCcMeMDG+w== 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=WiSbwUAFI4oRksMWMywyVIYPBIPT9zbCn5sqw74EWAQ=; b=RTFEb8e9dbKkI3gpdSVodRmD5TRGl/XKYR8zsXoSYn9z4Jo3FfZ9Xc6zbjUS2SbLgoWG9Sky7q4qDmk+oFQW8lmrr9FK+iGBMHOMDdaiIakJaOFabSeNhP1e9dcoXqICgL/5KUHgxxobOSVUhVtm1UfEpwIXwRlqxXMVg8pVgxY= Authentication-Results: in-advantage.com; dkim=none (message not signed) header.d=none;in-advantage.com; dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MWHPR10MB2030.namprd10.prod.outlook.com (2603:10b6:300:10d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Sat, 14 Aug 2021 02:50:18 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::e81f:cf8e:6ad6:d24d]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::e81f:cf8e:6ad6:d24d%3]) with mapi id 15.20.4415.019; Sat, 14 Aug 2021 02:50:18 +0000 From: Colin Foster To: colin.foster@in-advantage.com, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, hkallweit1@gmail.com, linux@armlinux.org.uk Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v3 net-next 04/10] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices Date: Fri, 13 Aug 2021 19:49:57 -0700 Message-Id: <20210814025003.2449143-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210814025003.2449143-1-colin.foster@in-advantage.com> References: <20210814025003.2449143-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::12) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.185.175.147) by MW4P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Sat, 14 Aug 2021 02:50:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a012fac0-e8a5-4d7b-f83c-08d95ece3fed X-MS-TrafficTypeDiagnostic: MWHPR10MB2030: X-MS-Exchange-Transport-Forked: True 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: X4poMkRthp0E0h46nUsAryT6uS65fnZhrdJRQ5B9dicyrToH2BtdV/o1ymMzy96EFnfTAxXq7QZxHgftMbTjzXaIsVh8AcfWTRn49xEY52Ywrw/2+tLl/iHg2vqrX7jdGWp3+9iXFWKZPA2OgpknaQZsONj8fdGcy9J2PPsOBKZDgjd6rsp+QYpDgKMS68it+Xjz3avNxbi6dvhV5Yh/dBRpMhd/gxJSyDb7pGh/4PCZH/EvBofVMVxRYjJfUXojAwDwZsdCY0RthHusAS75wGVNkk4dG16uL+Fyaam7Gr14vP6qBwsvEUpJ8Y7TqqLG+IguE8H7p5O5mw8QdkeI8ilnB7egZ5jekhPY7KZSdVkJRIrvQpZ4phBYaRDpNjZE7bBB5sfGrY3tJq0iHm27cd4JFoyUyEl3t4zLmOtzsh32xHnvSn542/W9+AdLdkaVMp1u4OY7oCsIhxgcAyzJ/3ELbfAMdR6cSM8YkDKmcHiHBZ4gfHkE4C1jD4JWObe3AocQ4VGiIrEBvKUV5ETJqiXfzJ89wv71SwHLCXkpn2NJdnu5wC7HPVgVRlRcxaClJk7HhG3jZCeLkTdT0mCgWXQf9Twj908zKQEXY22llIQLAYjXXdnD6aX2cGWyOdr3O3bq2gg/PzmVUUbHGGzZ8XkfcfJKjAzjAigE1hc+b8nurmLp5aJjk3I+yEDsAW1b07y+XgTPLGJBTGX20cKHVQHH/g4jIT0xZPVStqDDfy8= 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:(366004)(396003)(346002)(39830400003)(136003)(376002)(186003)(5660300002)(4744005)(316002)(4326008)(8936002)(6486002)(2906002)(52116002)(66476007)(66556008)(44832011)(956004)(2616005)(66946007)(1076003)(921005)(36756003)(83380400001)(38100700002)(38350700002)(6512007)(6506007)(26005)(478600001)(8676002)(86362001)(6666004)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QOcbCxoxcjKcY4wcwCrXEGLNCDAyuh6jpTmEFinlVfDdRNYi/5NSvf1u/zM/?= =?us-ascii?Q?posbO/MWAgIkrh6pZs5JOwTR4UCKgUvyZVtYvU/wwrBVPkVNvWa7eAkCM5F9?= =?us-ascii?Q?kF6oxtyjSrmZpPmvZCrx52nJFihV7hJaCwUJ9DQ+qmcZc+RdufrxVQoIc2/T?= =?us-ascii?Q?ofiV4J7nTeqRoXM2sTP+70gMtL+NBlwnatJ3XW4H9m2OWxivU/SAWWWbPsoa?= =?us-ascii?Q?O5BMCYztmWbCyrssDOZAF13PIQw3yQKBcVkcxKKDw+BLbSYDp1rpoBwFAMfD?= =?us-ascii?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t7+auI17r1niRea/wVV?= =?us-ascii?Q?aSKXHvVL1q8ZWpIERyqgJ7km8AsLD/b3qRL+328WcfY0gdRq68MvatG7ZCAp?= =?us-ascii?Q?7NbXxBjuTogiVtkZ2mWiAroNCspDpDkr6QCPVlBcq6hpSfjARgEKh4AjEwp7?= =?us-ascii?Q?2FXH2OY14zfyj/kBpUuTRnKE?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: a012fac0-e8a5-4d7b-f83c-08d95ece3fed X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2021 02:50:18.0538 (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: 72xN17mfP/7jHXkiLMLbMeN39nB9id01Xxd9MfDIkqUFiEaF6cvwp+cqSVIpSl5GrqbHczsEGIPTv8BSluQyR3MNgEdGkcpfOIAa2+hF8+g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB2030 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 ce607fbaaa3a..74ae322b2126 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -852,7 +852,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.25.1