From: Dan Carpenter <dan.carpenter@linaro.org>
To: Cosmin Tanislav <cosmin.tanislav@analog.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] serial: max310x: Add error checking in probe()
Date: Thu, 7 Aug 2025 18:54:37 +0300 [thread overview]
Message-ID: <aJTMPZiKqeXSE-KM@stanley.mountain> (raw)
Check if devm_i2c_new_dummy_device() fails.
Fixes: 2e1f2d9a9bdb ("serial: max310x: implement I2C support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/tty/serial/max310x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 541c790c0109..2b42a4c21a9b 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1644,6 +1644,8 @@ static int max310x_i2c_probe(struct i2c_client *client)
port_client = devm_i2c_new_dummy_device(&client->dev,
client->adapter,
port_addr);
+ if (IS_ERR(port_client))
+ return PTR_ERR(port_client);
regcfg_i2c.name = max310x_regmap_name(i);
regmaps[i] = devm_regmap_init_i2c(port_client, ®cfg_i2c);
--
2.47.2
next reply other threads:[~2025-08-07 15:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 15:54 Dan Carpenter [this message]
2025-08-07 21:30 ` [PATCH] serial: max310x: Add error checking in probe() Andy Shevchenko
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=aJTMPZiKqeXSE-KM@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=andy.shevchenko@gmail.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=cosmin.tanislav@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel-janitors@vger.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