Pass the expected response length and destination buffer directly to
i2c_smbus_read_block_data() in atla10_ec_cmd() instead of copying
through an intermediate buffer.

Signed-off-by: Dmitry Torokhov <[email protected]>
---
 drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c 
b/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c
index 67dba9aa51f6..bbfa040cd4ec 100644
--- a/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c
+++ b/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c
@@ -65,16 +65,14 @@ struct atla10_ec_data {
 static int atla10_ec_cmd(struct atla10_ec_data *data, u8 cmd, u8 len, u8 
*values)
 {
        struct device *dev = &data->client->dev;
-       u8 buf[I2C_SMBUS_BLOCK_MAX];
        int ret;
 
-       ret = i2c_smbus_read_block_data(data->client, cmd, buf);
+       ret = i2c_smbus_read_block_data(data->client, cmd, len, values);
        if (ret != len) {
                dev_err(dev, "I2C command 0x%02x error: %d\n", cmd, ret);
                return -EIO;
        }
 
-       memcpy(values, buf, len);
        return 0;
 }
 

-- 
2.56.0.257.gf7497c7d27-goog



_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to