[PATCH] ppc32: Fix crash on load in DACA sound driver

The DACA sound driver (early iBook models) doesn't clear the i2c_client
structure. That cause the embedded struct device (and thus kobject) to
contain garbage in the "k_name" field, which kobject_set_name will
later try to kfree...

Also remove references to unused struct data_data.
parent 713f18e9
...@@ -42,11 +42,6 @@ static int daca_detach_client(struct i2c_client *client); ...@@ -42,11 +42,6 @@ static int daca_detach_client(struct i2c_client *client);
/* Unique ID allocation */ /* Unique ID allocation */
static int daca_id; static int daca_id;
struct daca_data
{
int arf; /* place holder for furture use */
};
struct i2c_driver daca_driver = { struct i2c_driver daca_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "DAC3550A driver V " DACA_VERSION, .name = "DAC3550A driver V " DACA_VERSION,
...@@ -168,12 +163,12 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address) ...@@ -168,12 +163,12 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address)
{ {
const char *client_name = "DAC 3550A Digital Equalizer"; const char *client_name = "DAC 3550A Digital Equalizer";
struct i2c_client *new_client; struct i2c_client *new_client;
struct daca_data *data;
int rc = -ENODEV; int rc = -ENODEV;
new_client = kmalloc(sizeof(*new_client) + sizeof(*data), GFP_KERNEL); new_client = kmalloc(sizeof(*new_client), GFP_KERNEL);
if (!new_client) if (!new_client)
return -ENOMEM; return -ENOMEM;
memset(new_client, 0, sizeof(*new_client));
new_client->addr = address; new_client->addr = address;
new_client->adapter = adapter; new_client->adapter = adapter;
...@@ -182,9 +177,6 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address) ...@@ -182,9 +177,6 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address)
strcpy(new_client->name, client_name); strcpy(new_client->name, client_name);
new_client->id = daca_id++; /* racy... */ new_client->id = daca_id++; /* racy... */
data = (struct daca_data *)(new_client+1);
dev_set_drvdata(&new_client->dev, data);
if (daca_init_client(new_client)) if (daca_init_client(new_client))
goto bail; goto bail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment