From: Dan Carpenter <dan.carpenter@oracle.com>
To: u.kleine-koenig@pengutronix.de
Cc: NXP Linux Team <linux-imx@nxp.com>, linux-i2c@vger.kernel.org
Subject: [bug report] i2c: imx: Make sure to unregister adapter on remove()
Date: Thu, 25 Aug 2022 16:28:19 +0300 [thread overview]
Message-ID: <Ywd48/BdaB0Tcwpg@kili> (raw)
Hello Uwe Kleine-König,
The patch d98bdd3a5b50: "i2c: imx: Make sure to unregister adapter on
remove()" from Jul 20, 2022, leads to the following Smatch static
checker warning:
drivers/i2c/busses/i2c-imx.c:1586 i2c_imx_remove()
warn: pm_runtime_get_sync() also returns 1 on success
drivers/i2c/busses/i2c-imx.c
1570 static int i2c_imx_remove(struct platform_device *pdev)
1571 {
1572 struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev);
1573 int irq, ret;
1574
1575 ret = pm_runtime_get_sync(&pdev->dev);
1576
1577 hrtimer_cancel(&i2c_imx->slave_timer);
1578
1579 /* remove adapter */
1580 dev_dbg(&i2c_imx->adapter.dev, "adapter removed\n");
1581 i2c_del_adapter(&i2c_imx->adapter);
1582
1583 if (i2c_imx->dma)
1584 i2c_imx_dma_free(i2c_imx);
1585
--> 1586 if (ret == 0) {
Probably this should be ret >= 0?
1587 /* setup chip registers to defaults */
1588 imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR);
1589 imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
1590 imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR);
1591 imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR);
1592 clk_disable(i2c_imx->clk);
1593 }
1594
1595 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
1596 irq = platform_get_irq(pdev, 0);
1597 if (irq >= 0)
1598 free_irq(irq, i2c_imx);
1599
1600 clk_unprepare(i2c_imx->clk);
1601
1602 pm_runtime_put_noidle(&pdev->dev);
1603 pm_runtime_disable(&pdev->dev);
1604
1605 return 0;
1606 }
regards,
dan carpenter
next reply other threads:[~2022-08-25 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 13:28 Dan Carpenter [this message]
2022-09-12 13:24 ` [bug report] i2c: imx: Make sure to unregister adapter on remove() Uwe Kleine-König
2022-09-12 13:29 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ywd48/BdaB0Tcwpg@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.