Message ID | 20210826024121.15665-2-chris.packham@alliedtelesis.co.nz (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon: (adt7470) Clean up | expand |
On Thu, Aug 26, 2021 at 02:41:18PM +1200, Chris Packham wrote: > In preparation for the changes that follow fix up some existing style > issues. > Specifically: > - add blank line between variable declaration and code > - use strscpy instead of strlcpy > - remove unnecessary braces > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Applied. Thanks, Guenter > --- > Changes in v2: > - new > > drivers/hwmon/adt7470.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c > index 2e8feacccf84..3358ec58b977 100644 > --- a/drivers/hwmon/adt7470.c > +++ b/drivers/hwmon/adt7470.c > @@ -174,6 +174,7 @@ struct adt7470_data { > static inline int adt7470_read_word_data(struct i2c_client *client, u8 reg) > { > u16 foo; > + > foo = i2c_smbus_read_byte_data(client, reg); > foo |= ((u16)i2c_smbus_read_byte_data(client, reg + 1) << 8); > return foo; > @@ -1282,7 +1283,7 @@ static int adt7470_detect(struct i2c_client *client, > if (revision != ADT7470_REVISION) > return -ENODEV; > > - strlcpy(info->type, "adt7470", I2C_NAME_SIZE); > + strscpy(info->type, "adt7470", I2C_NAME_SIZE); > > return 0; > } > @@ -1331,9 +1332,8 @@ static int adt7470_probe(struct i2c_client *client) > > data->auto_update = kthread_run(adt7470_update_thread, client, "%s", > dev_name(hwmon_dev)); > - if (IS_ERR(data->auto_update)) { > + if (IS_ERR(data->auto_update)) > return PTR_ERR(data->auto_update); > - } > > return 0; > }
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 2e8feacccf84..3358ec58b977 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c @@ -174,6 +174,7 @@ struct adt7470_data { static inline int adt7470_read_word_data(struct i2c_client *client, u8 reg) { u16 foo; + foo = i2c_smbus_read_byte_data(client, reg); foo |= ((u16)i2c_smbus_read_byte_data(client, reg + 1) << 8); return foo; @@ -1282,7 +1283,7 @@ static int adt7470_detect(struct i2c_client *client, if (revision != ADT7470_REVISION) return -ENODEV; - strlcpy(info->type, "adt7470", I2C_NAME_SIZE); + strscpy(info->type, "adt7470", I2C_NAME_SIZE); return 0; } @@ -1331,9 +1332,8 @@ static int adt7470_probe(struct i2c_client *client) data->auto_update = kthread_run(adt7470_update_thread, client, "%s", dev_name(hwmon_dev)); - if (IS_ERR(data->auto_update)) { + if (IS_ERR(data->auto_update)) return PTR_ERR(data->auto_update); - } return 0; }
In preparation for the changes that follow fix up some existing style issues. Specifically: - add blank line between variable declaration and code - use strscpy instead of strlcpy - remove unnecessary braces Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> --- Changes in v2: - new drivers/hwmon/adt7470.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)