From patchwork Sun Feb 11 15:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Dulov X-Patchwork-Id: 199470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1968913dyd; Sun, 11 Feb 2024 07:10:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpDPTyJS9hNP6L26BRuu2Zd+OVqYVh4HSWaZDbQ8onGKRN26Z6v0usifbAWslp+924oS8d X-Received: by 2002:a05:622a:409:b0:42a:3ca8:910f with SMTP id n9-20020a05622a040900b0042a3ca8910fmr6603734qtx.39.1707664222118; Sun, 11 Feb 2024 07:10:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664222; cv=pass; d=google.com; s=arc-20160816; b=YA5Nbl438nJcwbuYIZo/7ZZh6RL9zcEJDYkIKae5yCwZHbFwaCrrFzVJ9/RFmfUscv QMAoRg5Fn2Ls7dNI6Hj5ywad4d2JR5nlekswFuitrJjxt7qYAVB/NXHP8ThD3cMGWCgf S1YWonkWU/qVA7A2/KeTLrnwWKePtOXWlJ5rJ5oGU6ae6NVJGfup4SQp2NR1s8ZoCRsx WquhMP7xodw8RsY4i31KFJv/ndbMqKq9wdEklroS0am8SecNxKgAfkRJpz1ONuTURqIy 1secqSbc2MTdHYCs0m5OBUWyITna19kfq3tGle+aD+YO1k5mvQovXtc9x9YVPCzc6gPK q+jg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=jI7jF4SbYcpzaXqpSP3YEPzOoCI+H+3PA2/zEShhNDQ=; fh=FOI2/crHcJ2Nbdp8iN/7mcxiFdSWxl/3GCcQ14iWccM=; b=ck9QA35/bHzPxJJJs4JLOU6qUuCVUIauAXa2b+3rZg4p29FVAOk6Vi5bGQwdBxBfOD vW0nYdLDvRpqJKfDwRU9uKJsFQuClL4v4O4Rr3rw/9RlGwTOsCKT9sqkyknWK2URtmxE H90jgFtUS/y9zFaoqBpklp3ThVU4pXot8RCi0Gf6amQWdPPplCRJQPLG6FcZvcI98MQm /oAHmc7/ttwDpbwzI0uOP/t8G/vbILsm4SVK8n2k9LZT73AjRS9EUsz23I0tfFrGujqp GfS04/LZ+cC3NBSzFH3J96QO9ZjqcQAKHQUTBHq7m2tlZYoMSNoCkDru00BpydPn7VNM eZDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60822-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60822-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCVMCyE5PSLc6tZVAX293yrDwCNkgfsFNX0Pkjr2jcWrqfqPTTYiMp6CU4BRMMFiS35OfODo53MxeXl6w49dmldPy6IdLw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k16-20020ac85fd0000000b0042c76db7571si767580qta.180.2024.02.11.07.10.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60822-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60822-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60822-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E38081C20D8A for ; Sun, 11 Feb 2024 15:10:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61C965E208; Sun, 11 Feb 2024 15:08:16 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31C415D8EE; Sun, 11 Feb 2024 15:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664094; cv=none; b=JwUb4si6qEcYCuig43iGCDzgk5WhkxUutdipRcfA9mKv8l2WrE+gz2RHDZ/4XD44NPnS8x95E3OBRs/0N+D9uhBhca3nacYtTCUUkASxWfLpkx7jZMnDOJApwPtYLPmgL1w4CjfbuovzmVKxWO7Kl1MQB5g6KVdmqDlV/Zktuv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664094; c=relaxed/simple; bh=6lVtZwGVnQw7WJULx6ndFVpcSiHixpJ5yBr0YKaxalw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=TnAbiJg0zdC1dlDm3QMywIfydEX8vttgGqDb7A2BNbNEVb6PVhzBLxwzONhUVEvi5q2bcnHtCn0FajJM9iYCT7wLp3g5EcLXivp0x11SkD+DtF2OO9evV894Qj3hScTMw6u7apfagsne1ZqrHEamiBddcA0DuCPz/cppndXIlys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Woojung Huh CC: Daniil Dulov , , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Alexandre Belloni , Helmut Grohne , , , Subject: [PATCH 18/18] net: dsa: microchip: Check return value of of_get_phy_mode() Date: Sun, 11 Feb 2024 07:08:04 -0800 Message-ID: <20240211150804.3893-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EXCH-2016-03.aladdin.ru (192.168.1.103) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790615719194285538 X-GMAIL-MSGID: 1790615719194285538 of_get_phy_mode() may return an error, so add a check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: edecfa98f602 ("net: dsa: microchip: look for phy-mode in port nodes") Signed-off-by: Daniil Dulov --- drivers/net/dsa/microchip/ksz_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index e3c338624b95..faffce6ea1e1 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -434,8 +434,10 @@ int ksz_switch_register(struct ksz_device *dev, continue; if (port_num >= dev->mib_port_cnt) return -EINVAL; - of_get_phy_mode(port, + ret = of_get_phy_mode(port, &dev->ports[port_num].interface); + if (ret) + return ret; } dev->synclko_125 = of_property_read_bool(dev->dev->of_node, "microchip,synclko-125");