Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- 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 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox