From f1a3fcead3c8807dfccf5199244c7229c965e346 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Mon, 14 Jul 2008 22:38:24 +0200 Subject: [PATCH] --- yaml --- r: 101286 b: refs/heads/master c: 6ea438ec8da4ec56bf415f5ea360e6b0cb59c6c3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/i2c/i2c-core.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 4a285b7cab51..9c24b3fd73d6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a1cdedac634eef81f747078bf1c27ad36ab13553 +refs/heads/master: 6ea438ec8da4ec56bf415f5ea360e6b0cb59c6c3 diff --git a/trunk/drivers/i2c/i2c-core.c b/trunk/drivers/i2c/i2c-core.c index 527d51319f3c..b995502400b8 100644 --- a/trunk/drivers/i2c/i2c-core.c +++ b/trunk/drivers/i2c/i2c-core.c @@ -866,8 +866,9 @@ EXPORT_SYMBOL(i2c_detach_client); */ struct i2c_client *i2c_use_client(struct i2c_client *client) { - get_device(&client->dev); - return client; + if (client && get_device(&client->dev)) + return client; + return NULL; } EXPORT_SYMBOL(i2c_use_client); @@ -879,7 +880,8 @@ EXPORT_SYMBOL(i2c_use_client); */ void i2c_release_client(struct i2c_client *client) { - put_device(&client->dev); + if (client) + put_device(&client->dev); } EXPORT_SYMBOL(i2c_release_client);