diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-12-12 23:10:33 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-12-17 12:26:14 +0100 |
commit | 426ba13f41e59151dce5d20dca1d4279192b60dc (patch) | |
tree | d4cf21589fa3c4d2cef35a9c0304b5be013e257e /drivers/video | |
parent | ac6bbe6ab32309218d1806572e0f1f331f9a8dcd (diff) | |
download | barebox-426ba13f41e59151dce5d20dca1d4279192b60dc.tar.gz barebox-426ba13f41e59151dce5d20dca1d4279192b60dc.tar.xz |
video: mtl017: Make sure errno is not used as a regulator pointer
Since regulator_get() can return an errno via regulator pointer, we
need to make sure we handle that case without passing bogus pointers
around.
Add code to convert mtl017->regulator to a dummy regulator if
regulator_get() fails.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/mtl017.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/mtl017.c b/drivers/video/mtl017.c index 085ea110ba..423fb8e4fd 100644 --- a/drivers/video/mtl017.c +++ b/drivers/video/mtl017.c @@ -244,6 +244,9 @@ static int mtl017_probe(struct device_d *dev) mtl017->client = to_i2c_client(dev); mtl017->regulator = regulator_get(dev, "vdd"); + if (IS_ERR(mtl017->regulator)) + mtl017->regulator = NULL; + mtl017->enable_gpio = of_get_named_gpio_flags(dev->device_node, "enable-gpios", 0, &flags); if (gpio_is_valid(mtl017->enable_gpio)) { |