Commit e16b9c8c authored by Hugo Villeneuve's avatar Hugo Villeneuve Committed by Greg Kroah-Hartman

serial: max310x: use dev_err_probe() instead of dev_err()

Replace dev_err() with dev_err_probe().

This helps in simplifing code and standardizing the error output.
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20240118152213.2644269-12-hugo@hugovil.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d5dd265c
...@@ -1275,10 +1275,9 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty ...@@ -1275,10 +1275,9 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
/* Alloc port structure */ /* Alloc port structure */
s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL); s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL);
if (!s) { if (!s)
dev_err(dev, "Error allocating port structure\n"); return dev_err_probe(dev, -ENOMEM,
return -ENOMEM; "Error allocating port structure\n");
}
/* Always ask for fixed clock rate from a property. */ /* Always ask for fixed clock rate from a property. */
device_property_read_u32(dev, "clock-frequency", &uartclk); device_property_read_u32(dev, "clock-frequency", &uartclk);
...@@ -1299,8 +1298,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty ...@@ -1299,8 +1298,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
if (freq == 0) if (freq == 0)
freq = uartclk; freq = uartclk;
if (freq == 0) { if (freq == 0) {
dev_err(dev, "Cannot get clock rate\n"); ret = dev_err_probe(dev, -EINVAL, "Cannot get clock rate\n");
ret = -EINVAL;
goto out_clk; goto out_clk;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment