]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
soc: qcom/spm: shut up uninitialized variable warning
authorArnd Bergmann <arnd@arndb.de>
Sun, 17 Jan 2016 00:02:56 +0000 (01:02 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 20 Oct 2016 13:05:26 +0000 (08:05 -0500)
BugLink: http://bugs.launchpad.net/bugs/1627730
commit 00affcac69c7aae6c2cfcbc71f724e1c16d0b445 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/soc/qcom/spm.c

index b04b05a0904eec086c49250c3dc4e27cb84a3927..65bce1eecaf868ddd60cca8324920f5d5fa57802 100644 (file)
@@ -288,7 +288,7 @@ static struct spm_driver_data *spm_get_drv(struct platform_device *pdev,
        struct spm_driver_data *drv = NULL;
        struct device_node *cpu_node, *saw_node;
        int cpu;
-       bool found;
+       bool found = 0;
 
        for_each_possible_cpu(cpu) {
                cpu_node = of_cpu_device_node_get(cpu);