radeon/i2c: do not count reg index in number of i2c byte we are writing.
authorJerome Glisse <jglisse@redhat.com>
Wed, 6 Nov 2013 22:42:02 +0000 (17:42 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Nov 2013 20:29:32 +0000 (15:29 -0500)
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@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/radeon/atombios_i2c.c

index deaf98cdca3acb80300b889b61ddf5a7f83d20b8..0652ee0a20989db0b69f816d45e17f9354e5ca8a 100644 (file)
@@ -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) {