Re: [PATCH 1/2] drivers/edac: Add L1 and L2 error detection for A53, A57 and A72

From: Vijay Balakrishna
Date: Thu Apr 10 2025 - 18:29:30 EST


On 4/10/2025 1:04 PM, Tyler Hicks (Microsoft) wrote:
+static int __init cortex_arm64_edac_driver_init(void)
+{
+ struct device_node *np;
+ int cpu;
+ struct platform_device *pdev;
+ int err;
+
+ for_each_possible_cpu(cpu) {
+ np = of_get_cpu_node(cpu, NULL);
Copilot correctly points out that we don't check np for NULL here. I think
of_match_node() handles that fine but we get fairly deep into the call stack
before it is caught. Let's go ahead and proactive check the return value.

More importantly, it pointed out that we don't call of_node_put(np) before
moving onto the next CPU. This would result in a refcount issue and will need
to be fixed.

Good catch. Let me change in next version.

Thanks,
Vijay