net: gianfar: dispose irq mappings on probe failure and device removal
authorRosen Penev <rosenp@gmail.com>
Fri, 26 Jun 2026 22:52:28 +0000 (15:52 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 30 Jun 2026 10:19:07 +0000 (12:19 +0200)
commitdbf803bc4a8b0522c9a12560c20905a5952d1cb9
tree710c3facb3003f51cc149988de62218b715be35c
parent39139b1c1c2b614096519b526112c726adb12ff0
net: gianfar: dispose irq mappings on probe failure and device removal

irq_of_parse_and_map() creates irqdomain mappings that should be
balanced with irq_dispose_mapping(). The driver never called
irq_dispose_mapping(), leaking mappings on probe failure and
device removal.

Fix by adding irq_dispose_mapping() in free_gfar_dev() and
expanding its loop from priv->num_grps to MAXGROUPS so the
error path also catches partially-initialized groups. All
irqinfo pointers are pre-initialized to NULL in gfar_of_init(),
making the NULL-guarded walk in free_gfar_dev() safe for every
scenario.

gfar_parse_group() itself is left as a simple parse function
with no resource management; cleanup is centralized in the
caller's error path.

Assisted-by: opencode:big-pickle
Fixes: b31a1d8b4151 ("gianfar: Convert gianfar to an of_platform_driver")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260626225228.427392-1-rosenp@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/freescale/gianfar.c