radeon/i2c: do not count reg index in number of i2c byte we are writing.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:10 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=fae009d15a44e5f1d938340facf4b8bc7dc69a09
Commit:     fae009d15a44e5f1d938340facf4b8bc7dc69a09
Parent:     936b32643cb03dcb34ef5dab81970229b1cc2a33
Author:     Jerome Glisse <jglisse at redhat.com>
AuthorDate: Wed Nov 6 17:42:02 2013 -0500
Committer:  Alex Deucher <alexander.deucher at amd.com>
CommitDate: Fri Nov 15 15:29:32 2013 -0500

    radeon/i2c: do not count reg index in number of i2c byte we are writing.
    
    Useless to count the register index in number of bytes we are writing.
    
    Fixes a regression with hw i2c enabled.
    
    Signed-off-by: Jerome Glisse <jglisse at redhat.com>
    Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
    Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_i2c.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c
index deaf98c..0652ee0 100644
--- a/drivers/gpu/drm/radeon/atombios_i2c.c
+++ b/drivers/gpu/drm/radeon/atombios_i2c.c
@@ -56,8 +56,10 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
 			return -EINVAL;
 		}
 		args.ucRegIndex = buf[0];
-		if (num > 1)
-			memcpy(&out, &buf[1], num - 1);
+		if (num > 1) {
+			num--;
+			memcpy(&out, &buf[1], num);
+		}
 		args.lpI2CDataOut = cpu_to_le16(out);
 	} else {
 		if (num > ATOM_MAX_HW_I2C_READ) {



More information about the linux-mtd-cvs mailing list