Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331541
b: refs/heads/master
c: 71b5784
h: refs/heads/master
i:
  331539: 3244af9
v: v3
  • Loading branch information
Julia Lawall authored and Jean Delvare committed Oct 5, 2012
1 parent 61496d6 commit d7aa3cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eee543e8248150e8fb833943c71f40c7b1724600
refs/heads/master: 71b578452ec6b2e8a470e3dae89055cd1068a9f0
11 changes: 4 additions & 7 deletions trunk/drivers/i2c/i2c-smbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ static int smbalert_probe(struct i2c_client *ara,
struct i2c_adapter *adapter = ara->adapter;
int res;

alert = kzalloc(sizeof(struct i2c_smbus_alert), GFP_KERNEL);
alert = devm_kzalloc(&ara->dev, sizeof(struct i2c_smbus_alert),
GFP_KERNEL);
if (!alert)
return -ENOMEM;

Expand All @@ -154,10 +155,8 @@ static int smbalert_probe(struct i2c_client *ara,
if (setup->irq > 0) {
res = devm_request_irq(&ara->dev, setup->irq, smbalert_irq,
0, "smbus_alert", alert);
if (res) {
kfree(alert);
if (res)
return res;
}
}

i2c_set_clientdata(ara, alert);
Expand All @@ -167,14 +166,12 @@ static int smbalert_probe(struct i2c_client *ara,
return 0;
}

/* IRQ resource is managed so it is freed automatically */
/* IRQ and memory resources are managed so they are freed automatically */
static int smbalert_remove(struct i2c_client *ara)
{
struct i2c_smbus_alert *alert = i2c_get_clientdata(ara);

cancel_work_sync(&alert->alert);

kfree(alert);
return 0;
}

Expand Down

0 comments on commit d7aa3cc

Please sign in to comment.