]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
iio: ak8975: fix maybe-uninitialized warning
authorRichard Leitner <dev@g0hl1n.net>
Tue, 5 Apr 2016 13:03:48 +0000 (15:03 +0200)
committerKamal Mostafa <kamal@canonical.com>
Mon, 16 May 2016 17:28:25 +0000 (10:28 -0700)
commit5daaefcecf9d563207cfcd32ddb6bbb479138cfc
treefb7533d884a13bf653503789dcb417c3b5a76f76
parenta67ecbbf6b97dd91ed95abcec10235ecdc633b19
iio: ak8975: fix maybe-uninitialized warning

BugLink: http://bugs.launchpad.net/bugs/1580754
commit 05be8d4101d960bad271d32b4f6096af1ccb1534 upstream.

If i2c_device_id *id is NULL and acpi_match_device returns NULL too,
then chipset may be unitialized when accessing &ak_def_array[chipset] in
ak8975_probe. Therefore initialize chipset to AK_MAX_TYPE, which will
return an error when not changed.

This patch fixes the following maybe-uninitialized warning:

drivers/iio/magnetometer/ak8975.c: In function ‘ak8975_probe’:
drivers/iio/magnetometer/ak8975.c:788:14: warning: ‘chipset’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  data->def = &ak_def_array[chipset];

Signed-off-by: Richard Leitner <dev@g0hl1n.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/iio/magnetometer/ak8975.c