gpio: max732x: Fix possible NULL pointer dereference on i2c_new_dummy error
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Thu, 6 Mar 2014 09:31:16 +0000 (10:31 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 12 Mar 2014 13:50:51 +0000 (14:50 +0100)
commitf561b4230cec90137baeba1b1c9302461939b870
treede04fd6a5d6f86c76a3663e46a04c05c1f661177
parentc75793d8ab743acdd07120cf11c0242daea8f780
gpio: max732x: Fix possible NULL pointer dereference on i2c_new_dummy error

In max732x_probe() driver allocates dummy I2C device (if number of ports
is greater than 8) with i2c_new_dummy() but it does not check the return
value of this call.

In case of error (i2c_new_device(): memory allocation failure or I2C
address cannot be used) this function returns NULL which is later
dereferenced by i2c_smbus_read_byte() (called from max732x_readb()).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-max732x.c