diff options
author | Annaliese McDermond <nh6z@nh6z.net> | 2019-06-21 03:52:49 -0700 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2019-06-26 15:14:21 +0200 |
commit | 4a5cfa39465cad25dd736d7ceba8a5d32eea4ecc (patch) | |
tree | 6907a7ed22397a32bad4e14338792626bdefa75d /drivers/i2c/busses | |
parent | 550113d4e9f5c7b62be760fc01178c9e0139c1f4 (diff) | |
download | linux-4a5cfa39465cad25dd736d7ceba8a5d32eea4ecc.tar.bz2 |
i2c: bcm2835: Move IRQ request after clock code in probe
If any of the clock code in the probe fails and returns, the IRQ
will not be freed. Moving the IRQ request to last allows it to
be freed on any errors further up in the probe function. devm_
calls can apparently not be used because there are some potential
race conditions that will arise.
Fixes: bebff81fb8b9 ("i2c: bcm2835: Model Divider in CCF")
Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Acked-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-bcm2835.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c index 5b556274cdb6..512c63871bd3 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c @@ -416,20 +416,6 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) if (IS_ERR(i2c_dev->regs)) return PTR_ERR(i2c_dev->regs); - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq) { - dev_err(&pdev->dev, "No IRQ resource\n"); - return -ENODEV; - } - i2c_dev->irq = irq->start; - - ret = request_irq(i2c_dev->irq, bcm2835_i2c_isr, IRQF_SHARED, - dev_name(&pdev->dev), i2c_dev); - if (ret) { - dev_err(&pdev->dev, "Could not request IRQ\n"); - return -ENODEV; - } - mclk_name = of_clk_get_parent_name(pdev->dev.of_node, 0); bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk_name, i2c_dev); @@ -459,6 +445,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) return ret; } + irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!irq) { + dev_err(&pdev->dev, "No IRQ resource\n"); + return -ENODEV; + } + i2c_dev->irq = irq->start; + + ret = request_irq(i2c_dev->irq, bcm2835_i2c_isr, IRQF_SHARED, + dev_name(&pdev->dev), i2c_dev); + if (ret) { + dev_err(&pdev->dev, "Could not request IRQ\n"); + return -ENODEV; + } + adap = &i2c_dev->adapter; i2c_set_adapdata(adap, i2c_dev); adap->owner = THIS_MODULE; |