diff options
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 527d51319f3c..b995502400b8 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -866,8 +866,9 @@ EXPORT_SYMBOL(i2c_detach_client); | |||
866 | */ | 866 | */ |
867 | struct i2c_client *i2c_use_client(struct i2c_client *client) | 867 | struct i2c_client *i2c_use_client(struct i2c_client *client) |
868 | { | 868 | { |
869 | get_device(&client->dev); | 869 | if (client && get_device(&client->dev)) |
870 | return client; | 870 | return client; |
871 | return NULL; | ||
871 | } | 872 | } |
872 | EXPORT_SYMBOL(i2c_use_client); | 873 | EXPORT_SYMBOL(i2c_use_client); |
873 | 874 | ||
@@ -879,7 +880,8 @@ EXPORT_SYMBOL(i2c_use_client); | |||
879 | */ | 880 | */ |
880 | void i2c_release_client(struct i2c_client *client) | 881 | void i2c_release_client(struct i2c_client *client) |
881 | { | 882 | { |
882 | put_device(&client->dev); | 883 | if (client) |
884 | put_device(&client->dev); | ||
883 | } | 885 | } |
884 | EXPORT_SYMBOL(i2c_release_client); | 886 | EXPORT_SYMBOL(i2c_release_client); |
885 | 887 | ||