aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorPeter Huewe <peterhuewe@gmx.de>2013-01-29 16:01:59 -0500
committerKent Yoder <key@linux.vnet.ibm.com>2013-02-05 10:38:25 -0500
commit64298919ad034aa07a6ec85b82e5c8861e364ae5 (patch)
tree3629ae0922e2825cca7e70eaabe7e7c9409ee055 /drivers/char/tpm
parentd479042c82941772cb1c003b46707d55185a49f6 (diff)
char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignment
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>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 8c60d33d116c..16f1f785c0b9 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -96,15 +96,13 @@ enum tis_defaults {
96static int write8_reg(struct i2c_client *client, u8 tpm_register, 96static int write8_reg(struct i2c_client *client, u8 tpm_register,
97 u8 *tpm_data, u16 tpm_size) 97 u8 *tpm_data, u16 tpm_size)
98{ 98{
99 u8 data;
100 int value = 0; 99 int value = 0;
101 struct st33zp24_platform_data *pin_infos; 100 struct st33zp24_platform_data *pin_infos;
102 101
103 pin_infos = client->dev.platform_data; 102 pin_infos = client->dev.platform_data;
104 103
105 data = tpm_register; 104 pin_infos->tpm_i2c_buffer[0][0] = tpm_register;
106 memcpy(pin_infos->tpm_i2c_buffer[0], &data, sizeof(data)); 105 memcpy(&pin_infos->tpm_i2c_buffer[0][1], tpm_data, tpm_size);
107 memcpy(pin_infos->tpm_i2c_buffer[0] + 1, tpm_data, tpm_size);
108 value = i2c_master_send(client, pin_infos->tpm_i2c_buffer[0], 106 value = i2c_master_send(client, pin_infos->tpm_i2c_buffer[0],
109 tpm_size + 1); 107 tpm_size + 1);
110 return value; 108 return value;