Skip to contentSkip to conversation

eeprom: at24: use dev_err_probe() consistently

PATCH Applied Bartosz Golaszewski 1 participant 2 messages Dec 12, 2025 – Dec 17, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eeprom: at24: use dev_err_probe() consistently

Save some lines by consistently using dev_err_probe() when bailing out with an error message.

---
 drivers/misc/eeprom/at24.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/misc/eeprom/at24.c +7 -13
index f721825199ce..0200288d3a7a 100644
@@ -657,10 +657,8 @@ static int at24_probe(struct i2c_client *client)
 	if (!i2c_fn_i2c && !i2c_fn_block)
 		page_size = 1;
 
-	if (!page_size) {
-		dev_err(dev, "page_size must not be 0!\n");
-		return -EINVAL;
-	}
+	if (!page_size)
+		return dev_err_probe(dev, -EINVAL, "page_size must not be 0!\n");
 
 	if (!is_power_of_2(page_size))
 		dev_warn(dev, "page_size looks suspicious (no power of 2)!\n");
@@ -674,11 +672,9 @@ static int at24_probe(struct i2c_client *client)
 				(flags & AT24_FLAG_ADDR16) ? 65536 : 256);
 	}
 
-	if ((flags & AT24_FLAG_SERIAL) && (flags & AT24_FLAG_MAC)) {
-		dev_err(dev,
-			"invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC.");
-		return -EINVAL;
-	}
+	if ((flags & AT24_FLAG_SERIAL) && (flags & AT24_FLAG_MAC))
+		return dev_err_probe(dev, -EINVAL,
+				     "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC.");
 
 	regmap_config.val_bits = 8;
 	regmap_config.reg_bits = (flags & AT24_FLAG_ADDR16) ? 16 : 8;
@@ -759,10 +755,8 @@ static int at24_probe(struct i2c_client *client)
 	full_power = acpi_dev_state_d0(&client->dev);
 	if (full_power) {
 		err = regulator_enable(at24->vcc_reg);
-		if (err) {
-			dev_err(dev, "Failed to enable vcc regulator\n");
-			return err;
-		}
+		if (err)
+			return dev_err_probe(dev, err, "Failed to enable vcc regulator\n");
 
 		pm_runtime_set_active(dev);
 	}
Signature · 1 line
2.51.0
author Applied
#1 lore raw
Quoted 4 lines · Bartosz Golaszewski

Save some lines by consistently using dev_err_probe() when bailing out with an error message.

Applied, thanks!

[1/1] eeprom: at24: use dev_err_probe() consistently

      commit: 7a29af24b288eace769ccd9eb8044742dfbd5944

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>