Skip to content

Commit

Permalink
char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Huewe authored and Kent Yoder committed Feb 5, 2013
1 parent d479042 commit 6429891
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/char/tpm/tpm_i2c_stm_st33.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6429891

Please sign in to comment.