Re: [PATCH 2/2] irqchip: Add Xilinx Versal NET SMMU CSR interrupt controller driver
From: Tushar Nimkar
Date: Mon Aug 31 2026 - 07:36:46 EST
Hi Thomas,
I realized later and thought to get a clarification on devm_kzalloc()/devm_of_iomap() - both need a struct device *, but this driver registers via IRQCHIP_DECLARE, so xilinx_smmu_csr_init() is called from of_irq_init() during early boot — there's no bound struct device at that point. AFAIK - If I get device from of_find_device_by_node() it might return NULL since of_irq_init() time the platform bus isn't populated yet.okay+{devm_kzalloc()
+ struct xilinx_smmu_csr *csr;
+ int ret;
+
+ if (WARN_ON_ONCE(!parent))
+ return -EINVAL;
+
+ if (irq_find_matching_fwnode(of_fwnode_handle(node),
+ DOMAIN_BUS_ANY))
+ return -ENODEV;
+
+ csr = kzalloc(sizeof(*csr), GFP_KERNEL);
okay
+ if (!csr)devm_of_iomap()
+ return -ENOMEM;
+
+ raw_spin_lock_init(&csr->lock);
+
+ csr->base = of_iomap(node, 0);
So I think we should keep using kzalloc()/of_iomap() - what do you think?
Thanks,
Tushar Nimkar