From 5ef6e5295386f9f606ea39e40ac5859e60f88274 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 1 Oct 2009 07:46:33 +0200 Subject: [PATCH] --- yaml --- r: 166772 b: refs/heads/master c: 18c4078489fe064cc0ed08be3381cf2f26657f5f h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/sound/aoa/codecs/tas.c | 9 +++++++++ trunk/sound/ppc/keywest.c | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 7ff76ae04982..861791275ffa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5da5b6f9e967e8c62486444f97e66252c3768d7d +refs/heads/master: 18c4078489fe064cc0ed08be3381cf2f26657f5f diff --git a/trunk/sound/aoa/codecs/tas.c b/trunk/sound/aoa/codecs/tas.c index f0ebc971c686..1dd66ddffcaf 100644 --- a/trunk/sound/aoa/codecs/tas.c +++ b/trunk/sound/aoa/codecs/tas.c @@ -897,6 +897,15 @@ static int tas_create(struct i2c_adapter *adapter, client = i2c_new_device(adapter, &info); if (!client) return -ENODEV; + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, and then there + * is no point in keeping the device instantiated. + */ + if (!client->driver) { + i2c_unregister_device(client); + return -ENODEV; + } /* * Let i2c-core delete that device on driver removal. diff --git a/trunk/sound/ppc/keywest.c b/trunk/sound/ppc/keywest.c index 835fa19ed461..bb6819aab133 100644 --- a/trunk/sound/ppc/keywest.c +++ b/trunk/sound/ppc/keywest.c @@ -59,6 +59,18 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) strlcpy(info.type, "keywest", I2C_NAME_SIZE); info.addr = keywest_ctx->addr; keywest_ctx->client = i2c_new_device(adapter, &info); + if (!keywest_ctx->client) + return -ENODEV; + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, and then there + * is no point in keeping the device instantiated. + */ + if (!keywest_ctx->client->driver) { + i2c_unregister_device(keywest_ctx->client); + keywest_ctx->client = NULL; + return -ENODEV; + } /* * Let i2c-core delete that device on driver removal.