From: Hans Verkuil Date: Wed, 3 Sep 2008 20:12:09 +0000 (-0300) Subject: V4L/DVB (8790): saa7115: call i2c_set_clientdata only when state != NULL X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c5bf204f42423f49d7ea34f14eef92780204e168;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git V4L/DVB (8790): saa7115: call i2c_set_clientdata only when state != NULL Not a bug as such, but it looks really strange doing this before checking whether the state structure could be allocated. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index bcd1c8f6cf6b..ad733caec720 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1489,10 +1489,9 @@ static int saa7115_probe(struct i2c_client *client, client->addr << 1, client->adapter->name); state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); - i2c_set_clientdata(client, state); - if (state == NULL) { + if (state == NULL) return -ENOMEM; - } + i2c_set_clientdata(client, state); state->input = -1; state->output = SAA7115_IPORT_ON; state->enable = 1;