mirror of
https://github.com/torvalds/linux.git
synced 2025-04-06 00:16:18 +00:00
i3c: master: Drop duplicate check before calling OF APIs
OF APIs are usually NULL-aware and returns an error in case when device node is not present or supported. We already have a check for the returned value, no need to check for the parameter. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250321193044.457649-1-andriy.shevchenko@linux.intel.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
e8d2d287e2
commit
465e5486aa
@ -2276,7 +2276,7 @@ static int of_i3c_master_add_dev(struct i3c_master_controller *master,
|
||||
u32 reg[3];
|
||||
int ret;
|
||||
|
||||
if (!master || !node)
|
||||
if (!master)
|
||||
return -EINVAL;
|
||||
|
||||
ret = of_property_read_u32_array(node, "reg", reg, ARRAY_SIZE(reg));
|
||||
@ -2369,14 +2369,10 @@ static u8 i3c_master_i2c_get_lvr(struct i2c_client *client)
|
||||
{
|
||||
/* Fall back to no spike filters and FM bus mode. */
|
||||
u8 lvr = I3C_LVR_I2C_INDEX(2) | I3C_LVR_I2C_FM_MODE;
|
||||
u32 reg[3];
|
||||
|
||||
if (client->dev.of_node) {
|
||||
u32 reg[3];
|
||||
|
||||
if (!of_property_read_u32_array(client->dev.of_node, "reg",
|
||||
reg, ARRAY_SIZE(reg)))
|
||||
lvr = reg[2];
|
||||
}
|
||||
if (!of_property_read_u32_array(client->dev.of_node, "reg", reg, ARRAY_SIZE(reg)))
|
||||
lvr = reg[2];
|
||||
|
||||
return lvr;
|
||||
}
|
||||
@ -2486,7 +2482,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
|
||||
struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
|
||||
struct i2c_dev_desc *i2cdev;
|
||||
struct i2c_dev_boardinfo *i2cboardinfo;
|
||||
int ret, id = -ENODEV;
|
||||
int ret, id;
|
||||
|
||||
adap->dev.parent = master->dev.parent;
|
||||
adap->owner = master->dev.parent->driver->owner;
|
||||
@ -2497,9 +2493,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
|
||||
adap->timeout = 1000;
|
||||
adap->retries = 3;
|
||||
|
||||
if (master->dev.of_node)
|
||||
id = of_alias_get_id(master->dev.of_node, "i2c");
|
||||
|
||||
id = of_alias_get_id(master->dev.of_node, "i2c");
|
||||
if (id >= 0) {
|
||||
adap->nr = id;
|
||||
ret = i2c_add_numbered_adapter(adap);
|
||||
|
Loading…
x
Reference in New Issue
Block a user