From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 6E7C73BE63A for ; Thu, 12 Mar 2026 10:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773310332; cv=none; b=HAthvTrjxpk/Ownb88xZ3qR/ryWZ/La+dGSBqrMcQ/Zb5MgG5bM+lVtl0q0jNUUamh9mICS7dxIaC+Oopup77Px+SM04JUSYdEF2qf/F8jAIFJ/DD0OAVSbTwYE0HhL2dpxOSf3L+1A45bUzAHCMBbE8XZXP7zTFsoS5FRlWu5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773310332; c=relaxed/simple; bh=0JNH+vV9m6Q+pG8VsJX1wdlMdhhBGkOHek4F0EB6bdU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Xk9ASN0PLGcifM8CED6bOjzH+l4GzjxuxuaOQqu97fhBYW48w11PzWEhId3QOfvEwU7TiiyF8OHGBxgH1kD4HdcJZOYge2zr+QwoBLWUk1aLZiDM9kUhrxjk54NoyyLA85VAazg9pZGGGKz8fz7uGlhLoz6KNuzByw1Lge8smaA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=uTy1jOSg; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="uTy1jOSg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 200704E42658; Thu, 12 Mar 2026 10:12:10 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DF6365FDEB; Thu, 12 Mar 2026 10:12:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3782310369C61; Thu, 12 Mar 2026 11:12:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773310327; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZScxyatlTWwp4VNBkqTha4B6duYhO6GHXUx9ibpGkcE=; b=uTy1jOSgn+W8bTv2Bu4HIkJ8axtG/wxKhMn+PbT6zK+r5oqzCkIgeV0QZcW/LQGyWkDjIC 21cUmsPqAuliL36gz5dC82ca7VnYBtrVVlmCYMFT9c+OGPOzrVTACPxsT/Jsp79ELcW9ZL yDHOVpcBarPpgEcakALDfZgunbdvLRP/lvbcGrwswLN2uzGPCP0LewYtKmyi3mzm6oqtYa uQ+JpyQUuK7PfkpMx+RFci2j2NzaSgbgR0ci0gGlLRxhydcEChudsq5l6rvSM2BHdZhO6x BF/fUQAiyBZ0xoCx4Z+5LKINSwkONA2qgogKbav9QeWb1pIqGRpxAWSKWSdxFw== From: =?UTF-8?q?Th=C3=A9o=20Lebrun?= To: theo.lebrun@bootlin.com Cc: Ryan.Wanner@microchip.com, Valentina.FernandezAlanis@microchip.com, abin.joseph@amd.com, alex@ghiti.fr, andrew+netdev@lunn.ch, aou@eecs.berkeley.edu, claudiu.beznea@tuxon.dev, conor+dt@kernel.org, conor.dooley@microchip.com, conor@kernel.org, daire.mcnamara@microchip.com, dave.stevenson@raspberrypi.com, davem@davemloft.net, devicetree@vger.kernel.org, edumazet@google.com, gregory.clement@bootlin.com, krzk+dt@kernel.org, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org, nicolas.ferre@microchip.com, pabeni@redhat.com, palmer@dabbelt.com, pjw@kernel.org, richardcochran@gmail.com, robh@kernel.org, samuel.holland@sifive.com, sean.anderson@linux.dev, thomas.petazzoni@bootlin.com, vineeth.karumanchi@amd.com Subject: [PATCH 2/3] net: macb: set MACB_CAPS_USRIO_DISABLED if no usrio config is provided Date: Thu, 12 Mar 2026 11:11:37 +0100 Message-ID: <20260312101138.465482-2-theo.lebrun@bootlin.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312101138.465482-1-theo.lebrun@bootlin.com> References: <20260312101138.465482-1-theo.lebrun@bootlin.com> 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 X-Last-TLS-Session-Version: TLSv1.3 bp->usrio is copied directly from dt_conf->usrio in macb_probe(). If dt_conf->usrio is NULL, we do not want to land in USRIO write codepaths which dereference bp->usrio. Inherit automatically MACB_CAPS_USRIO_DISABLED to avoid those. This means a macb_config that wants to disable usrio can simply drop its .usrio field, rather than add the disabled capability explicitly. Nit: drop the dt_conf NULL check because the pointer is always valid. Signed-off-by: Théo Lebrun --- drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index ecab7fdc962d..972499aa4191 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4470,8 +4470,10 @@ static void macb_configure_caps(struct macb *bp, { u32 dcfg; - if (dt_conf) - bp->caps = dt_conf->caps; + bp->caps = dt_conf->caps; + + if (!dt_conf->usrio) + bp->caps |= MACB_CAPS_USRIO_DISABLED; if (hw_is_gem(bp->regs, bp->native_io)) { bp->caps |= MACB_CAPS_MACB_IS_GEM; -- 2.53.0