char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignment
authorPeter Huewe <peterhuewe@gmx.de>
Tue, 29 Jan 2013 21:01:59 +0000 (22:01 +0100)
committerKent Yoder <key@linux.vnet.ibm.com>
Tue, 5 Feb 2013 15:38:25 +0000 (09:38 -0600)
We don't need to call memcpy for one byte, but assign it directly.
And to make the offset clearer we use the array syntax on the subsequent
call to memset to make the relationship clearer.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
drivers/char/tpm/tpm_i2c_stm_st33.c

index 8c60d33d116c5716136dae97499d8829d543e1c4..16f1f785c0b9d5d3fd5f884a256f3a42bbfd08ba 100644 (file)
@@ -96,15 +96,13 @@ enum tis_defaults {
 static int write8_reg(struct i2c_client *client, u8 tpm_register,
                      u8 *tpm_data, u16 tpm_size)
 {
-       u8 data;
        int value = 0;
        struct st33zp24_platform_data *pin_infos;
 
        pin_infos = client->dev.platform_data;
 
-       data = tpm_register;
-       memcpy(pin_infos->tpm_i2c_buffer[0], &data, sizeof(data));
-       memcpy(pin_infos->tpm_i2c_buffer[0] + 1, tpm_data, tpm_size);
+       pin_infos->tpm_i2c_buffer[0][0] = tpm_register;
+       memcpy(&pin_infos->tpm_i2c_buffer[0][1], tpm_data, tpm_size);
        value = i2c_master_send(client, pin_infos->tpm_i2c_buffer[0],
                                tpm_size + 1);
        return value;