diff mbox

i2c: omap: don't save a value only needed for read-clearing

Message ID 1352913666-11022-1-git-send-email-wolfram@the-dreams.de (mailing list archive)
State New, archived
Headers show

Commit Message

Wolfram Sang Nov. 14, 2012, 5:21 p.m. UTC
Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
---

This makes one of my code analyzers happy and makes me a part of the
i2c-omap-patch crowd \o/

 drivers/i2c/busses/i2c-omap.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Felipe Balbi Nov. 14, 2012, 6:37 p.m. UTC | #1
Hi,

On Wed, Nov 14, 2012 at 06:21:06PM +0100, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>

fine by me. I'd like to see a commit log (even if obvious) there. But no
strong feelings.

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
> 
> This makes one of my code analyzers happy and makes me a part of the

anything open source which we could all be using ? :-)

> i2c-omap-patch crowd \o/
> 
>  drivers/i2c/busses/i2c-omap.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 482c63d..49b12fb 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1291,14 +1291,13 @@ static int omap_i2c_runtime_suspend(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
> -	u16 iv;
>  
>  	_dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
>  
>  	omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, 0);
>  
>  	if (_dev->rev < OMAP_I2C_OMAP1_REV_2) {
> -		iv = omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
> +		omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
>  	} else {
>  		omap_i2c_write_reg(_dev, OMAP_I2C_STAT_REG, _dev->iestate);
>  
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Nov. 14, 2012, 6:50 p.m. UTC | #2
> > This makes one of my code analyzers happy and makes me a part of the
> 
> anything open source which we could all be using ? :-)

'my' as in 'one of those I am using'. It was cppcheck which found that
flaw. Its use for kernel code is limited, but it does find one or the
other thing.
Shubhrajyoti Datta Nov. 15, 2012, 10:04 a.m. UTC | #3
On Thu, Nov 15, 2012 at 12:20 AM, Wolfram Sang <w.sang@pengutronix.de> wrote:
>
>> > This makes one of my code analyzers happy and makes me a part of the
>>
>> anything open source which we could all be using ? :-)
>
> 'my' as in 'one of those I am using'. It was cppcheck which found that
> flaw. Its use for kernel code is limited, but it does find one or the
> other thing.

sparse did not complain though.
So it seems it helps to run multiple static tools:-)

>
> --
> Pengutronix e.K.                           | Wolfram Sang                |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi Nov. 15, 2012, 12:51 p.m. UTC | #4
Hi,

On Thu, Nov 15, 2012 at 03:34:10PM +0530, Shubhrajyoti Datta wrote:
> On Thu, Nov 15, 2012 at 12:20 AM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> >
> >> > This makes one of my code analyzers happy and makes me a part of the
> >>
> >> anything open source which we could all be using ? :-)
> >
> > 'my' as in 'one of those I am using'. It was cppcheck which found that
> > flaw. Its use for kernel code is limited, but it does find one or the
> > other thing.
> 
> sparse did not complain though.
> So it seems it helps to run multiple static tools:-)

or sending a patch to sparse ;-)
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 482c63d..49b12fb 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1291,14 +1291,13 @@  static int omap_i2c_runtime_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
-	u16 iv;
 
 	_dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
 
 	omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, 0);
 
 	if (_dev->rev < OMAP_I2C_OMAP1_REV_2) {
-		iv = omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
+		omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
 	} else {
 		omap_i2c_write_reg(_dev, OMAP_I2C_STAT_REG, _dev->iestate);