Skip to contentSkip to conversation

iio: magnetometer: ak8975: remove unnecessary braces

PATCH In review Joshua Crofts 3 participants 3 messages Apr 17 – Apr 19 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: magnetometer: ak8975: remove unnecessary braces

Remove unnecessary braces at single if statement block.

No functional change.

---
 drivers/iio/magnetometer/ak8975.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/ak8975.c +2 -2
index d30315ad85..443011748b 100644
@@ -541,9 +541,9 @@ static int ak8975_set_mode(struct ak8975_data *data, enum ak_ctrl_mode mode)
 		 data->def->ctrl_modes[mode];
 	ret = i2c_smbus_write_byte_data(data->client,
 					data->def->ctrl_regs[CNTL], regval);
-	if (ret < 0) {
+	if (ret < 0)
 		return ret;
-	}
+
 	data->cntl_cache = regval;
 	/* After mode change wait atleast 100us */
 	usleep_range(100, 500);
Signature · 1 line
2.47.3
#1 lore raw
Quoted 3 lines · Joshua Crofts

Remove unnecessary braces at single if statement block.

No functional change.

Code wise is good, but I think it's an unneeded churn as a standalone change. Up to Jonathan.

...

drivers/iio/magnetometer/ak8975.c static int ak8975_set_mode(struct ak8975_data *data, enum ak_ctrl_mode mode) · line 548

Quoted 9 lines
drivers/iio/magnetometer/ak8975.c +2 -2
 	ret = i2c_smbus_write_byte_data(data->client,
 					data->def->ctrl_regs[CNTL], regval);
-	if (ret < 0) {
+	if (ret < 0)
 		return ret;
-	}
+
 	data->cntl_cache = regval;
 	/* After mode change wait atleast 100us */

Side note: you can also fix a typo (missing space) and

Quoted 1 line

usleep_range(100, 500);

move the driver to use fsleep().

(In a separate change.)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
Quoted 7 lines · On Fri, 17 Apr 2026 21:30:14 +0300 Andy Shevchenko…
Quoted 3 lines · Joshua Crofts

Remove unnecessary braces at single if statement block.

No functional change.

Code wise is good, but I think it's an unneeded churn as a standalone change. Up to Jonathan.

Whilst it's churn it's very localized and unlikely to cause us much trouble so I've taken it.

Other comments below make sense for follow up patches.

thanks,

Jonathan

Quoted 21 lines

...

drivers/iio/magnetometer/ak8975.c static int ak8975_set_mode(struct ak8975_data *data, enum ak_ctrl_mode mode) · line 548

Quoted 9 lines
drivers/iio/magnetometer/ak8975.c +2 -2
 	ret = i2c_smbus_write_byte_data(data->client,
 					data->def->ctrl_regs[CNTL], regval);
-	if (ret < 0) {
+	if (ret < 0)
 		return ret;
-	}
+
 	data->cntl_cache = regval;
 	/* After mode change wait atleast 100us */  

Side note: you can also fix a typo (missing space) and

Quoted 1 line

usleep_range(100, 500);

move the driver to use fsleep().

(In a separate change.)