Skip to content

Commit

Permalink
ARM: OMAP: Release i2c_adapter after use (Siemens SX1)
Browse files Browse the repository at this point in the history
Each call to i2c_get_adapter() must be followed by a call to
i2c_put_adapter() to release the grabbed reference. Otherwise the
reference count grows forever and the adapter can never be
unregistered.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Vladimir Ananiev <vovan888@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Feb 24, 2008
1 parent 4fa2b1c commit c9a2c46
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/mach-omap1/board-sx1.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
data[0] = regoffset; /* register num */
data[1] = value; /* register data */
err = i2c_transfer(adap, msg, 1);
i2c_put_adapter(adap);
if (err >= 0)
return 0;
return err;
Expand Down Expand Up @@ -91,6 +92,7 @@ int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value)
msg->buf = data;
err = i2c_transfer(adap, msg, 1);
*value = data[0];
i2c_put_adapter(adap);

if (err >= 0)
return 0;
Expand Down

0 comments on commit c9a2c46

Please sign in to comment.