X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=sound%2Fppc%2Fkeywest.c;h=6ff99ed77516e3c6f8dcaf9bbf4c4a9888a4ae36;hb=a491913ff22c2b69d937d14296db6fa34dbff068;hp=fb05938dcbd91c5a6f75e4191c1f74835010f4b0;hpb=4bbf7bc4c7bf1c80ec3c942fa5f1b6e6fa67dd99;p=linux-2.6-omap-h63xx.git diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index fb05938dcbd..6ff99ed7751 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -19,7 +19,6 @@ */ -#include #include #include #include @@ -34,8 +33,6 @@ static struct pmac_keywest *keywest_ctx; -#define I2C_DRIVERID_KEYWEST 0xFEBA - static int keywest_attach_adapter(struct i2c_adapter *adapter); static int keywest_detach_client(struct i2c_client *client); @@ -43,7 +40,6 @@ struct i2c_driver keywest_driver = { .driver = { .name = "PMac Keywest Audio", }, - .id = I2C_DRIVERID_KEYWEST, .attach_adapter = &keywest_attach_adapter, .detach_client = &keywest_detach_client, }; @@ -64,11 +60,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) if (strncmp(i2c_device_name(adapter), "mac-io", 6)) return 0; /* ignored */ - new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (! new_client) return -ENOMEM; - memset(new_client, 0, sizeof(*new_client)); new_client->addr = keywest_ctx->addr; i2c_set_clientdata(new_client, keywest_ctx); new_client->adapter = adapter; @@ -118,6 +113,9 @@ int __init snd_pmac_tumbler_post_init(void) { int err; + if (!keywest_ctx || !keywest_ctx->client) + return -ENXIO; + if ((err = keywest_ctx->init_client(keywest_ctx)) < 0) { snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err); return err;