serial: max310x: Add error checking in probe()
Subsystems (2)
PATCH 1/1 serial: max310x: Add error checking in probe()
Check if devm_i2c_new_dummy_device() fails.
Fixes 2e1f2d9a9bdb ("serial: max310x: implement I2C support")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/tty/serial/max310x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/max310x.c +2 -0
@@ -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);
Signature · 1 line
2.47.2
Quoted 2 lines · Dan Carpenter
Check if
devm_i2c_new_dummy_device()fails.
...
drivers/tty/serial/max310x.c static int max310x_i2c_probe(struct i2c_client *client) · line 1648
Quoted 5 lines
port_client = devm_i2c_new_dummy_device(&client->dev, client->adapter, port_addr);drivers/tty/serial/max310x.c +2
-0+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.
Signature · 2 lines
With Best Regards, Andy Shevchenko