aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-i801.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 5f827dfc671a..b1d725d758bb 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1138,7 +1138,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1138 int err, i; 1138 int err, i;
1139 struct i801_priv *priv; 1139 struct i801_priv *priv;
1140 1140
1141 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 1141 priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
1142 if (!priv) 1142 if (!priv)
1143 return -ENOMEM; 1143 return -ENOMEM;
1144 1144
@@ -1253,8 +1253,9 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1253 if (priv->features & FEATURE_IRQ) { 1253 if (priv->features & FEATURE_IRQ) {
1254 init_waitqueue_head(&priv->waitq); 1254 init_waitqueue_head(&priv->waitq);
1255 1255
1256 err = request_irq(dev->irq, i801_isr, IRQF_SHARED, 1256 err = devm_request_irq(&dev->dev, dev->irq, i801_isr,
1257 dev_driver_string(&dev->dev), priv); 1257 IRQF_SHARED,
1258 dev_driver_string(&dev->dev), priv);
1258 if (err) { 1259 if (err) {
1259 dev_err(&dev->dev, "Failed to allocate irq %d: %d\n", 1260 dev_err(&dev->dev, "Failed to allocate irq %d: %d\n",
1260 dev->irq, err); 1261 dev->irq, err);
@@ -1275,7 +1276,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1275 err = i2c_add_adapter(&priv->adapter); 1276 err = i2c_add_adapter(&priv->adapter);
1276 if (err) { 1277 if (err) {
1277 dev_err(&dev->dev, "Failed to add SMBus adapter\n"); 1278 dev_err(&dev->dev, "Failed to add SMBus adapter\n");
1278 goto exit_free_irq; 1279 goto exit_release;
1279 } 1280 }
1280 1281
1281 i801_probe_optional_slaves(priv); 1282 i801_probe_optional_slaves(priv);
@@ -1286,12 +1287,9 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1286 1287
1287 return 0; 1288 return 0;
1288 1289
1289exit_free_irq: 1290exit_release:
1290 if (priv->features & FEATURE_IRQ)
1291 free_irq(dev->irq, priv);
1292 pci_release_region(dev, SMBBAR); 1291 pci_release_region(dev, SMBBAR);
1293exit: 1292exit:
1294 kfree(priv);
1295 return err; 1293 return err;
1296} 1294}
1297 1295
@@ -1303,11 +1301,8 @@ static void i801_remove(struct pci_dev *dev)
1303 i2c_del_adapter(&priv->adapter); 1301 i2c_del_adapter(&priv->adapter);
1304 pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg); 1302 pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg);
1305 1303
1306 if (priv->features & FEATURE_IRQ)
1307 free_irq(dev->irq, priv);
1308 pci_release_region(dev, SMBBAR); 1304 pci_release_region(dev, SMBBAR);
1309 1305
1310 kfree(priv);
1311 /* 1306 /*
1312 * do not call pci_disable_device(dev) since it can cause hard hangs on 1307 * do not call pci_disable_device(dev) since it can cause hard hangs on
1313 * some systems during power-off (eg. Fujitsu-Siemens Lifebook E8010) 1308 * some systems during power-off (eg. Fujitsu-Siemens Lifebook E8010)