Skip to content

Commit

Permalink
V4L/DVB (8790): saa7115: call i2c_set_clientdata only when state != NULL
Browse files Browse the repository at this point in the history
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 <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Sep 3, 2008
1 parent dc60de3 commit c5bf204
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/media/video/saa7115.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c5bf204

Please sign in to comment.