From d7aa3cce844a32e2fd8b00a0013b96e31fdebba3 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 5 Oct 2012 22:23:52 +0200 Subject: [PATCH] --- yaml --- r: 331541 b: refs/heads/master c: 71b578452ec6b2e8a470e3dae89055cd1068a9f0 h: refs/heads/master i: 331539: 3244af9d2e49ba28bde18cc984e8c8a1c4ac3adb v: v3 --- [refs] | 2 +- trunk/drivers/i2c/i2c-smbus.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 5634259212de..f65eb9fcc8e0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eee543e8248150e8fb833943c71f40c7b1724600 +refs/heads/master: 71b578452ec6b2e8a470e3dae89055cd1068a9f0 diff --git a/trunk/drivers/i2c/i2c-smbus.c b/trunk/drivers/i2c/i2c-smbus.c index df3e0bf31eb3..92cdd2323b03 100644 --- a/trunk/drivers/i2c/i2c-smbus.c +++ b/trunk/drivers/i2c/i2c-smbus.c @@ -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; @@ -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); @@ -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; }