serial: max310x: Add error checking in probe()

Check if devm_i2c_new_dummy_device() fails.

Fixes: 2e1f2d9a9b ("serial: max310x: implement I2C support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/aJTMPZiKqeXSE-KM@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter
2025-08-07 18:54:37 +03:00
committed by Greg Kroah-Hartman
parent 3fc36ae6ab
commit 672a37ba8a

View File

@@ -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, &regcfg_i2c);