[PATCH 1/5] i2c: Add missing result check

Sascha Hauer s.hauer at pengutronix.de
Mon May 20 16:11:20 EDT 2013


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/i2c/i2c.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 4862df3..488b636 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -260,6 +260,10 @@ struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
 	client->dev.parent = &adapter->dev;
 
 	status = register_device(&client->dev);
+	if (status) {
+		free(client);
+		return NULL;
+	}
 
 #if 0
 	/* drivers may modify this initial i/o setup */
-- 
1.8.2.rc2




More information about the barebox mailing list