From f53b09dad8e22d19c98a9c136dcfd35dbd09428a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 24 Aug 2008 13:34:15 +0200 Subject: saa7115: call i2c_set_clientdata only when state != NULL From: Hans Verkuil Not a bug as such, but it looks really strange doing this before checking whether the state structure could be allocated. Priority: normal Signed-off-by: Hans Verkuil --- linux/drivers/media/video/saa7115.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c index 5488679ed..e2c68d8ca 100644 --- a/linux/drivers/media/video/saa7115.c +++ b/linux/drivers/media/video/saa7115.c @@ -1498,10 +1498,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; -- cgit v1.2.3