Skip to content

Commit 16e1583

Browse files
bwicaksononvwilldeacon
authored andcommitted
perf: arm_cspmu: Fix variable dereference warning
Fix warning message from smatch tool: | smatch warnings: | drivers/perf/arm_cspmu/arm_cspmu.c:1075 arm_cspmu_find_cpu_container() | warn: variable dereferenced before check 'cpu_dev' (see line 1073) Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected]/ Reviewed-by: Suzuki K Poulose <[email protected]> Signed-off-by: Besar Wicaksono <[email protected]> Acked-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent c61e572 commit 16e1583

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/perf/arm_cspmu/arm_cspmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,12 +1078,14 @@ static int arm_cspmu_request_irq(struct arm_cspmu *cspmu)
10781078
static inline int arm_cspmu_find_cpu_container(int cpu, u32 container_uid)
10791079
{
10801080
u32 acpi_uid;
1081-
struct device *cpu_dev = get_cpu_device(cpu);
1082-
struct acpi_device *acpi_dev = ACPI_COMPANION(cpu_dev);
1081+
struct device *cpu_dev;
1082+
struct acpi_device *acpi_dev;
10831083

1084+
cpu_dev = get_cpu_device(cpu);
10841085
if (!cpu_dev)
10851086
return -ENODEV;
10861087

1088+
acpi_dev = ACPI_COMPANION(cpu_dev);
10871089
while (acpi_dev) {
10881090
if (!strcmp(acpi_device_hid(acpi_dev),
10891091
ACPI_PROCESSOR_CONTAINER_HID) &&

0 commit comments

Comments
 (0)