summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo Lebrun <theo.lebrun@bootlin.com>2026-03-25 19:28:17 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-30 00:34:29 +0300
commit32fc6a9f6e7585b2b39999a22635c06aa810d1bc (patch)
tree1ac6c0b7dacead18a7e678b33f1630bcbe0cb181
parent47c86c463612edc3107eb7c0fd25b463f1756adf (diff)
downloadlinux-32fc6a9f6e7585b2b39999a22635c06aa810d1bc.tar.xz
net: macb: set MACB_CAPS_USRIO_DISABLED if no usrio config is provided
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 <theo.lebrun@bootlin.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Link: https://patch.msgid.link/20260325-husband-cape-ec4945b9184c@spud Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 281ab0d7b7c0..4dae84ceb545 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4577,8 +4577,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;