Skip to content

Commit 7a29af2

Browse files
author
Bartosz Golaszewski
committed
eeprom: at24: use dev_err_probe() consistently
Save some lines by consistently using dev_err_probe() when bailing out with an error message. Link: https://lore.kernel.org/r/20251212032646.49336-1-bartosz.golaszewski@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent 3011612 commit 7a29af2

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

drivers/misc/eeprom/at24.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,8 @@ static int at24_probe(struct i2c_client *client)
657657
if (!i2c_fn_i2c && !i2c_fn_block)
658658
page_size = 1;
659659

660-
if (!page_size) {
661-
dev_err(dev, "page_size must not be 0!\n");
662-
return -EINVAL;
663-
}
660+
if (!page_size)
661+
return dev_err_probe(dev, -EINVAL, "page_size must not be 0!\n");
664662

665663
if (!is_power_of_2(page_size))
666664
dev_warn(dev, "page_size looks suspicious (no power of 2)!\n");
@@ -674,11 +672,9 @@ static int at24_probe(struct i2c_client *client)
674672
(flags & AT24_FLAG_ADDR16) ? 65536 : 256);
675673
}
676674

677-
if ((flags & AT24_FLAG_SERIAL) && (flags & AT24_FLAG_MAC)) {
678-
dev_err(dev,
679-
"invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC.");
680-
return -EINVAL;
681-
}
675+
if ((flags & AT24_FLAG_SERIAL) && (flags & AT24_FLAG_MAC))
676+
return dev_err_probe(dev, -EINVAL,
677+
"invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC.");
682678

683679
regmap_config.val_bits = 8;
684680
regmap_config.reg_bits = (flags & AT24_FLAG_ADDR16) ? 16 : 8;
@@ -759,10 +755,8 @@ static int at24_probe(struct i2c_client *client)
759755
full_power = acpi_dev_state_d0(&client->dev);
760756
if (full_power) {
761757
err = regulator_enable(at24->vcc_reg);
762-
if (err) {
763-
dev_err(dev, "Failed to enable vcc regulator\n");
764-
return err;
765-
}
758+
if (err)
759+
return dev_err_probe(dev, err, "Failed to enable vcc regulator\n");
766760

767761
pm_runtime_set_active(dev);
768762
}

0 commit comments

Comments
 (0)