mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
iio: magnetometer: ak8975: reduce usage of magic lengths of the buffer
Reduce usage of magic lengths of the supplied buffer by replacing them with the corresponding sizeof():s. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
77e7524944
commit
dbb1f2fa2b
|
|
@ -489,8 +489,10 @@ static int ak8975_who_i_am(struct i2c_client *client,
|
|||
* AK8975 | DEVICE_ID | NA
|
||||
* AK8963 | DEVICE_ID | NA
|
||||
*/
|
||||
ret = i2c_smbus_read_i2c_block_data_or_emulated(
|
||||
client, AK09912_REG_WIA1, 2, wia_val);
|
||||
ret = i2c_smbus_read_i2c_block_data_or_emulated(client,
|
||||
AK09912_REG_WIA1,
|
||||
sizeof(wia_val),
|
||||
wia_val);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "Error reading WIA\n");
|
||||
return ret;
|
||||
|
|
@ -609,9 +611,10 @@ static int ak8975_setup(struct i2c_client *client)
|
|||
}
|
||||
|
||||
/* Get asa data and store in the device data. */
|
||||
ret = i2c_smbus_read_i2c_block_data_or_emulated(
|
||||
client, data->def->ctrl_regs[ASA_BASE],
|
||||
3, data->asa);
|
||||
ret = i2c_smbus_read_i2c_block_data_or_emulated(client,
|
||||
data->def->ctrl_regs[ASA_BASE],
|
||||
sizeof(data->asa),
|
||||
data->asa);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "Not able to read asa data\n");
|
||||
return ret;
|
||||
|
|
@ -866,7 +869,7 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev)
|
|||
*/
|
||||
ret = i2c_smbus_read_i2c_block_data_or_emulated(client,
|
||||
def->data_regs[0],
|
||||
3 * sizeof(fval[0]),
|
||||
sizeof(fval),
|
||||
(u8 *)fval);
|
||||
if (ret < 0)
|
||||
goto unlock;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user