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

iio: accel: mma9553: fix gpio bitnum init value

Initial value of gpio bitnum is set to -1, but
the variable is declared as unsigned.

Use a positive invalid value for initial gpio
bitnum.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Irina Tirdea and committed by
Jonathan Cameron
ef8307a2 334efd07

+2 -1
+2 -1
drivers/iio/accel/mma9553.c
··· 77 77 78 78 /* Bitnum used for GPIO configuration = bit number in high status byte */ 79 79 #define MMA9553_STATUS_TO_BITNUM(bit) (ffs(bit) - 9) 80 + #define MMA9553_MAX_BITNUM MMA9553_STATUS_TO_BITNUM(BIT(16)) 80 81 81 82 #define MMA9553_DEFAULT_SAMPLE_RATE 30 /* Hz */ 82 83 ··· 407 406 } 408 407 409 408 410 - data->gpio_bitnum = -1; 411 409 /* Reset GPIO */ 410 + data->gpio_bitnum = MMA9553_MAX_BITNUM; 412 411 ret = mma9553_conf_gpio(data); 413 412 if (ret < 0) 414 413 return ret;