* [PATCH] serial: max310x: Add error checking in probe()
@ 2025-08-07 15:54 Dan Carpenter
2025-08-07 21:30 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-08-07 15:54 UTC (permalink / raw)
To: Cosmin Tanislav
Cc: Greg Kroah-Hartman, Jiri Slaby, Bartosz Golaszewski,
Andy Shevchenko, linux-kernel, linux-serial, kernel-janitors
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: max310x: Add error checking in probe()
2025-08-07 15:54 [PATCH] serial: max310x: Add error checking in probe() Dan Carpenter
@ 2025-08-07 21:30 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-08-07 21:30 UTC (permalink / raw)
To: Dan Carpenter
Cc: Cosmin Tanislav, Greg Kroah-Hartman, Jiri Slaby,
Bartosz Golaszewski, linux-kernel, linux-serial, kernel-janitors
On Thu, Aug 7, 2025 at 5:54 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Check if devm_i2c_new_dummy_device() fails.
...
> port_client = devm_i2c_new_dummy_device(&client->dev,
> client->adapter,
> port_addr);
> + if (IS_ERR(port_client))
> + return PTR_ERR(port_client);
I'm wondering if this is indeed a critical error in this case, but okay.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-07 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 15:54 [PATCH] serial: max310x: Add error checking in probe() Dan Carpenter
2025-08-07 21:30 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox