perf/arm_cspmu: Improve sub-module error reporting
authorRobin Murphy <robin.murphy@arm.com>
Thu, 16 Jul 2026 14:56:36 +0000 (15:56 +0100)
committerWill Deacon <will@kernel.org>
Sun, 2 Aug 2026 11:16:21 +0000 (11:16 +0000)
When waiting for a sub-module to register, we return a bare
-EPROBE_DEFER that ends up showing the end user:

  platform arm-cs-arch-pmu.1: deferred probe pending (no reason)

wherein it's not necessarily clear that they might need to take some
action to ensure the appropriate module is available to load. Let's use
dev_err_probe() here so we can show exactly what we're waiting for.

Similarly, in the case where something's gone horribly wrong with an
already-registered module, we can use dev_WARN() to standardise the
device/driver attribution rather than just open-coding "arm_cspmu".

Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/arm_cspmu/arm_cspmu.c

index f4f071c..d641119 100644 (file)
@@ -437,13 +437,15 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu)
                                if (ret)
                                        module_put(match->module);
                        } else {
-                               WARN(1, "arm_cspmu failed to get module: %s\n",
+                               dev_WARN(cspmu->dev, "Failed to get module: %s\n",
                                        match->module_name);
                                ret = -EINVAL;
                        }
                } else {
                        request_module_nowait(match->module_name);
-                       ret = -EPROBE_DEFER;
+                       ret = dev_err_probe(cspmu->dev, -EPROBE_DEFER,
+                                           "Waiting for module %s to load\n",
+                                           match->module_name);
                }
 
                mutex_unlock(&arm_cspmu_lock);