Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: qcom/spm: shut up uninitialized variable warning

gcc warns about the 'found' variable possibly being used uninitialized:

drivers/soc/qcom/spm.c: In function 'spm_dev_probe':
drivers/soc/qcom/spm.c:305:5: error: 'found' may be used uninitialized in this function [-Werror=maybe-uninitialized]

However, the code is correct because we know that there is
always at least one online CPU. This initializes the 'found'
variable to zero before the loop so the compiler knows
it does not have to warn about it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+1 -1
+1 -1
drivers/soc/qcom/spm.c
··· 288 288 struct spm_driver_data *drv = NULL; 289 289 struct device_node *cpu_node, *saw_node; 290 290 int cpu; 291 - bool found; 291 + bool found = 0; 292 292 293 293 for_each_possible_cpu(cpu) { 294 294 cpu_node = of_cpu_device_node_get(cpu);