Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[sfrench/cifs-2.6.git] / sound / ppc / keywest.c
index 6058c2dd1b7fabc9e762c2f91a02abe878163faf..272ae38e9b1883154f7574000270a23b84d48b84 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/delay.h>
-#include <linux/i2c-dev.h>
 #include <linux/slab.h>
 #include <sound/core.h>
 #include "pmac.h"
@@ -65,11 +64,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;
@@ -119,6 +117,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;