From 89d68998308e16c49ce18b402d5f702d5a1767e5 Mon Sep 17 00:00:00 2001 From: Florian Vaussard Date: Tue, 25 Feb 2014 14:28:19 +0100 Subject: [PATCH] mfd: twl6040: Check for error when reading revision register We may have an error when reading the revision register, so check for the returned value. Acked-by: Peter Ujfalusi Signed-off-by: Florian Vaussard Signed-off-by: Lee Jones --- drivers/mfd/twl6040.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c index f15114f8c258..6e88f25832fb 100644 --- a/drivers/mfd/twl6040.c +++ b/drivers/mfd/twl6040.c @@ -661,6 +661,11 @@ static int twl6040_probe(struct i2c_client *client, init_completion(&twl6040->ready); twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV); + if (twl6040->rev < 0) { + dev_err(&client->dev, "Failed to read revision register: %d\n", + twl6040->rev); + goto gpio_err; + } /* ERRATA: Automatic power-up is not possible in ES1.0 */ if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) -- 2.20.1