diff options
author | Gregor Boirie <gregor.boirie@parrot.com> | 2016-03-03 11:44:03 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-03-05 15:18:05 +0000 |
commit | 55c0c530f7113d98cb1a0d42f15b8abe5e4b6928 (patch) | |
tree | 929407f9affb5b2b9e4537a0cffe44a98f43e3d8 /drivers/iio/magnetometer/ak8975.c | |
parent | f0fa15cce13d5987c50907eb98846d13e2b4d9ca (diff) |
iio:magnetometer:ak8975: fix uninitialized chipset
ak_def_array bounds are not properly checked in case of ACPI matching
failure. GCC warns with the following message at line 799:
‘chipset’ may be used uninitialized in this function.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer/ak8975.c')
-rw-r--r-- | drivers/iio/magnetometer/ak8975.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 9c5c9ef3f1da..11059b2c39a4 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -774,8 +774,11 @@ static int ak8975_probe(struct i2c_client *client, if (id) { chipset = (enum asahi_compass_chipset)(id->driver_data); name = id->name; - } else if (ACPI_HANDLE(&client->dev)) + } else if (ACPI_HANDLE(&client->dev)) { name = ak8975_match_acpi_device(&client->dev, &chipset); + if (!name) + return -ENODEV; + } else return -ENOSYS; |