From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Subject: [PATCH v1 1/1] serial: 8250_of: Use dev_err_probe() instead of dev_warn()
Date: Tue, 12 Sep 2023 19:56:07 +0300 [thread overview]
Message-ID: <20230912165607.402580-1-andriy.shevchenko@linux.intel.com> (raw)
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>
---
drivers/tty/serial/8250/8250_of.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 51329625c48a..8c61ed25a8e4 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -33,7 +33,8 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
struct of_serial_info *info)
{
struct resource resource;
- struct device_node *np = ofdev->dev.of_node;
+ struct device *dev = &ofdev->dev;
+ struct device_node *np = dev->of_node;
struct uart_port *port = &up->port;
u32 clk, spd, prop;
int ret, irq;
@@ -48,10 +49,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
/* Get clk rate through clk driver if present */
info->clk = devm_clk_get(&ofdev->dev, NULL);
if (IS_ERR(info->clk)) {
- ret = PTR_ERR(info->clk);
- if (ret != -EPROBE_DEFER)
- dev_warn(&ofdev->dev,
- "failed to get clock: %d\n", ret);
+ ret = dev_err_probe(dev, PTR_ERR(info->clk), "failed to get clock\n");
goto err_pmruntime;
}
@@ -67,7 +65,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
ret = of_address_to_resource(np, 0, &resource);
if (ret) {
- dev_warn(&ofdev->dev, "invalid address\n");
+ dev_err_probe(dev, ret, "invalid address\n");
goto err_unprepare;
}
@@ -85,9 +83,8 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
/* Check for shifted address mapping */
if (of_property_read_u32(np, "reg-offset", &prop) == 0) {
if (prop >= port->mapsize) {
- dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n",
- prop, &port->mapsize);
- ret = -EINVAL;
+ ret = dev_err_probe(dev, -EINVAL, "reg-offset %u exceeds region size %pa\n",
+ prop, &port->mapsize);
goto err_unprepare;
}
@@ -109,9 +106,8 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
UPIO_MEM32BE : UPIO_MEM32;
break;
default:
- dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n",
- prop);
- ret = -EINVAL;
+ ret = dev_err_probe(dev, -EINVAL, "unsupported reg-io-width (%u)\n",
+ prop);
goto err_unprepare;
}
}
--
2.40.0.1.gaa8946217a0b
reply other threads:[~2023-09-12 16:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230912165607.402580-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox