mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy error
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Tue, 11 Feb 2014 09:12:25 +0000 (10:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 May 2014 14:59:25 +0000 (07:59 -0700)
commit045d75e6434efe98576b2f80a4e93fa029a4f183
tree7627c01bf7a13c9cd2f875e4652bd723e2aa70dc
parent360fec6392d511b059562ac629b600fadc3cd77b
mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy error

commit 65aba1e04916d72b30c028730a1e31860c225412 upstream.

During probe the sec-core driver allocates dummy I2C device for RTC with
i2c_new_dummy() but return value is not checked. In case of error
(i2c_new_device(): memory allocation failure or I2C address cannot be
used) this function returns NULL which is later used by
devm_regmap_init_i2c() or i2c_unregister_device().

If i2c_new_dummy() fails for RTC device, fail also the probe for main
MFD driver.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mfd/sec-core.c