Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp285966rdb; Mon, 22 Jan 2024 04:20:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2lDRxe4gHQpd5mTko4S+h24fM7Komm26g3LhuW/7b4xA4oZsobIeUxaRsWoD/z9dAJpQf X-Received: by 2002:a05:6a20:8e0c:b0:19c:4c5c:51ff with SMTP id y12-20020a056a208e0c00b0019c4c5c51ffmr598419pzj.38.1705926016770; Mon, 22 Jan 2024 04:20:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705926016; cv=pass; d=google.com; s=arc-20160816; b=EgLZF5toxPAbwvzeLztWh6D/LIzyPnRUIwUa1vzHkCnQherBhGZvpx6gjwb++qd8oP xwbySyBuqHT5BjYNk2aAPjVeq0qWiimPY+BD3UmiXEi4539c29mhBMEBXoeXAS3G7Kh4 KCrFVtx+4XX6HqvH5W32RL5MIh4hGSvJYh7HHdiBpDbVpxazTTeuSybgOrmrqtB5yam7 e0G/jHSUNy2lEovSpJEKrxc71pM9+yn7Pypn53wVyZdAO9A5N9FP/XVCBmmNNeM3IZBb BQx/tAD5CqP+hQILKxHpUwGfvSceLEcf0YqlnnPWanxvMXBRY1kUN9FsxohtpsI5c+n6 l4HA== 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:dkim-signature; bh=Zemy8ZJn5fD/HAJy6AeSeL43fUsG/BaVJW5l8hEuiYo=; fh=uZUGNaNbTB4leTaWIJ4NY0WSjnrJK2yvJBZeSLh9DpQ=; b=NqbgT8RXNErMIlNu8SS6A7FYeui2E5xM7MVTrSmd5dwsUUiFfyqbDcbz40/A8b4APj 12vn3HLeIk8XcbnykgIBNoroa6ArsNODc6KdBQCSLYXGfrX39lx238/kFYzoGsijpySz +ZSPmAPMIzG4Vgvt74MY32BvJCy0I85KZdA3HUPve/Zm7dC6u3POLdMLnV7QP6GhIO6d BcnuNmUlwze6D0W1o5zXhcI8W/brnQr0+sgtrGZmoRokCSEjdRW1RAIz+Lsie6U3L/Lm YMg+H7KUpmbWxh4AthhXqN/9//f8ipe7wB9ALF/g+kYttgmlEViRoJXNtsy1s5ZUAQqT MFGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=Vxsnss3X; arc=pass (i=1 spf=pass spfdomain=ysoft.com dkim=pass dkdomain=ysoft.com dmarc=pass fromdomain=ysoft.com); spf=pass (google.com: domain of linux-kernel+bounces-32986-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx20-20020a056a02051400b005c6001ec190si8221014pgb.892.2024.01.22.04.20.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 04:20:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32986-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=Vxsnss3X; arc=pass (i=1 spf=pass spfdomain=ysoft.com dkim=pass dkdomain=ysoft.com dmarc=pass fromdomain=ysoft.com); spf=pass (google.com: domain of linux-kernel+bounces-32986-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 13077281B20 for ; Mon, 22 Jan 2024 12:12:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCAB63B2A6; Mon, 22 Jan 2024 12:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ysoft.com header.i=@ysoft.com header.b="Vxsnss3X" Received: from uho.ysoft.cz (uho.ysoft.cz [81.19.3.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ED743BB21; Mon, 22 Jan 2024 12:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.19.3.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705925518; cv=none; b=Wr269FIAXPaiIegy3wOgwq2cftxr1M8U/zVBm2d5r5uqvEfZTQMGJanACOIRQxaWJlb9+gpr0O21GvtmgtlVq97uisZ1qI358aPu115eRchoBDMAl1id+vvITxZ4/h//g1AXLpRluFmR+B/n1jGhEPhq99tmGINU8W8PT4Kyp44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705925518; c=relaxed/simple; bh=TPVj2fxS1zs2uqfH2OqzpWSshq8vUs1z/gIbUq8u8zk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=gH3sDj9hFC3+rr8BPOgdFe5CGH17f5imSSZGcEt5itECuYnrkRQZxYaWrPE3eUD7fxk1p4InSCC1cPw2LTHW4aTcyyZoz1yRg2ZlWnLP3Dx8sCSAx84XNQav91Xvma/JLdL5RoAg0IeLaDlfpUjXAS1m/cTZXgqBIaY5hAQEKMU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ysoft.com; spf=pass smtp.mailfrom=ysoft.com; dkim=pass (1024-bit key) header.d=ysoft.com header.i=@ysoft.com header.b=Vxsnss3X; arc=none smtp.client-ip=81.19.3.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ysoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ysoft.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1705925076; bh=Zemy8ZJn5fD/HAJy6AeSeL43fUsG/BaVJW5l8hEuiYo=; h=From:To:Cc:Subject:Date:From; b=Vxsnss3Xelc4d4COJPjkA/pP8rIdNLk5/pq1UjfwXrdTnCm8bxQ3sbyrBlIdp1OtJ NEs/p3pmHMCzkEAUKi1ZQzD/6c/H3DHuDlkcMz9reQAhyHTTBD3D2iHNQ4JlbSPTn9 QMBw33r5e1U9X2sDxwIQZId8Aog2Hx0rduTSRoJ0= Received: from iota-build.ysoft.local (unknown [10.1.5.151]) by uho.ysoft.cz (Postfix) with ESMTP id 59ED3A00CE; Mon, 22 Jan 2024 13:04:36 +0100 (CET) From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= To: Andrew Lunn , "David S. Miller" , Florian Fainelli Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Lamparter , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, petr.benes@ysoft.com, =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= Subject: [PATCH net] net: dsa: qca8k: fix illegal usage of GPIO Date: Mon, 22 Jan 2024 13:04:09 +0100 Message-Id: <1705925049-5756-1-git-send-email-michal.vokac@ysoft.com> X-Mailer: git-send-email 2.1.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When working with GPIO, its direction must be set either when the GPIO is requested by gpiod_get*() or later on by one of the gpiod_direction_*() functions. Neither of this is done here which result in undefined behavior on some systems. As the reset GPIO is used right after it is requested here, it makes sense to configure it as GPIOD_OUT_HIGH right away. Fixes: a653f2f538f9 ("net: dsa: qca8k: introduce reset via gpio feature") Signed-off-by: Michal Vokáč --- drivers/net/dsa/qca/qca8k-8xxx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 4ce68e655a63..83b19c2d7b97 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -2037,8 +2037,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) priv->dev = &mdiodev->dev; priv->info = of_device_get_match_data(priv->dev); - priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", - GPIOD_ASIS); + priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(priv->reset_gpio)) return PTR_ERR(priv->reset_gpio); -- 2.1.4