Commit c5bf204f authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent dc60de33
...@@ -1489,10 +1489,9 @@ static int saa7115_probe(struct i2c_client *client, ...@@ -1489,10 +1489,9 @@ static int saa7115_probe(struct i2c_client *client,
client->addr << 1, client->adapter->name); client->addr << 1, client->adapter->name);
state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
i2c_set_clientdata(client, state); if (state == NULL)
if (state == NULL) {
return -ENOMEM; return -ENOMEM;
} i2c_set_clientdata(client, state);
state->input = -1; state->input = -1;
state->output = SAA7115_IPORT_ON; state->output = SAA7115_IPORT_ON;
state->enable = 1; state->enable = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment