Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250_of: Use dev_err_probe() instead of dev_warn()

The probe process may generate EPROBE_DEFER. In this case
dev_err_probe() can still record err information. Otherwise
it may pollute logs on that occasion.

This also helps simplifing code and standardizing the error output.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230912165607.402580-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
4678de73 e8bbaeac

+8 -12
+8 -12
drivers/tty/serial/8250/8250_of.c
··· 33 33 struct of_serial_info *info) 34 34 { 35 35 struct resource resource; 36 - struct device_node *np = ofdev->dev.of_node; 36 + struct device *dev = &ofdev->dev; 37 + struct device_node *np = dev->of_node; 37 38 struct uart_port *port = &up->port; 38 39 u32 clk, spd, prop; 39 40 int ret, irq; ··· 49 48 /* Get clk rate through clk driver if present */ 50 49 info->clk = devm_clk_get(&ofdev->dev, NULL); 51 50 if (IS_ERR(info->clk)) { 52 - ret = PTR_ERR(info->clk); 53 - if (ret != -EPROBE_DEFER) 54 - dev_warn(&ofdev->dev, 55 - "failed to get clock: %d\n", ret); 51 + ret = dev_err_probe(dev, PTR_ERR(info->clk), "failed to get clock\n"); 56 52 goto err_pmruntime; 57 53 } 58 54 ··· 65 67 66 68 ret = of_address_to_resource(np, 0, &resource); 67 69 if (ret) { 68 - dev_warn(&ofdev->dev, "invalid address\n"); 70 + dev_err_probe(dev, ret, "invalid address\n"); 69 71 goto err_unprepare; 70 72 } 71 73 ··· 83 85 /* Check for shifted address mapping */ 84 86 if (of_property_read_u32(np, "reg-offset", &prop) == 0) { 85 87 if (prop >= port->mapsize) { 86 - dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n", 87 - prop, &port->mapsize); 88 - ret = -EINVAL; 88 + ret = dev_err_probe(dev, -EINVAL, "reg-offset %u exceeds region size %pa\n", 89 + prop, &port->mapsize); 89 90 goto err_unprepare; 90 91 } 91 92 ··· 106 109 UPIO_MEM32BE : UPIO_MEM32; 107 110 break; 108 111 default: 109 - dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n", 110 - prop); 111 - ret = -EINVAL; 112 + ret = dev_err_probe(dev, -EINVAL, "unsupported reg-io-width (%u)\n", 113 + prop); 112 114 goto err_unprepare; 113 115 } 114 116 }