Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2004136rdb; Sun, 11 Feb 2024 07:10:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZA1emewExL0Q75ax2V6NqRdZPDKA6vu+PLic+f81icOHQ289mmalPaLlxsXXjokH10u1N X-Received: by 2002:ac8:7d95:0:b0:42c:72a5:cd86 with SMTP id c21-20020ac87d95000000b0042c72a5cd86mr2290564qtd.1.1707664213570; Sun, 11 Feb 2024 07:10:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664213; cv=pass; d=google.com; s=arc-20160816; b=icALLHe6NYF45alt/BGrlqgYeiJ7CnXl1ZflwDyYWyVjB5687T/dTefRqRra2LkoST ZbLtva3ieLZkqrL2NgSlR5z+8q4rCe2jNiCd7lnXEMQtJgB8PqiPWZP21+ZiFdHF+Tav GrUy0ZIFfaxQW58bMA1G1qqdVFLl2BpRxiwjr/YsyVY0KJSV/HT43UWglU+kXaat1jfa wvMkFyra9RTwGL3CmfaFXEP0nNt+dBgwHryZPbfIIlMwkYkQob6wlywXNMAnCsPBgfxF QGNUwN1jITE4icaCgKJzlgFHMhWVMIuv1e4UrrYm29ax0NZ92gB+vsj7EE6WTVTnMyUz vhIQ== 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=QpuMuCOIRx/46cryYJEpGXwyg31dLXrCKyWrqf4ATf4=; b=AG+V3WQmO2+sJl69TYwv6x40rpM7lZoSlYusJN/wikC2GpnMI+owJGDxz7TeaemQ9l zKYMPt2I33pe1/8Kd5pCVPRiQ4jMstKVmNOl0DpEKt7PT/kQ+TPdCISlXEK2/xgWFI78 wJM3s4kwrazoHdB/LBn+5OLmZQoNgxEt5uRqMMg+984SHHxgtrahSIhgJra/BGo6IQFC fY+fJijDtW8Ugw0O9ujWLueopq+PAYb7HFDB5lT9nzXa1Jng3JuG7Mo1ns/vJSsXHcs2 H82O110wod//KLzz6V1zBueE8lIF18gGQAFR0IwBPlbqJbpi4tcbw35JWCY6afOyx9JA 6f1Q==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCWb46jsYNM87F3URzubPdjqMBvy3XiDXIwgHEPyYMcHwasUzL1o7UNvU+Lg5+1I6fyQFu5kT+nx7fo2OAKcLgeL+l8/T0E9hov9U32IGQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v9-20020a05622a014900b0042c40dfcfbfsi3483034qtw.60.2024.02.11.07.10.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:10:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60822-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60822-linux.lists.archive=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 4C5321C20CE3 for ; Sun, 11 Feb 2024 15:10:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51B2E5DF0D; Sun, 11 Feb 2024 15:08:15 +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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-03.aladdin.ru (192.168.1.103) To EXCH-2016-01.aladdin.ru (192.168.1.101) 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"); -- 2.25.1