Commit e1524a62 authored by Markus Elfring's avatar Markus Elfring Committed by Lee Jones

leds: ncp5623: Use common error handling code in ncp5623_probe()

Add a label so that a bit of exception handling can be better reused
at the end of this function implementation.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Link: https://lore.kernel.org/r/5faec5de-fc36-4b38-abcb-c61954a824cd@web.deSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent d33d1214
......@@ -183,16 +183,12 @@ static int ncp5623_probe(struct i2c_client *client)
fwnode_for_each_available_child_node(mc_node, led_node) {
ret = fwnode_property_read_u32(led_node, "color", &color_index);
if (ret) {
fwnode_handle_put(led_node);
goto release_mc_node;
}
if (ret)
goto release_led_node;
ret = fwnode_property_read_u32(led_node, "reg", &reg);
if (ret) {
fwnode_handle_put(led_node);
goto release_mc_node;
}
if (ret)
goto release_led_node;
subled_info[ncp->mc_dev.num_colors].channel = reg;
subled_info[ncp->mc_dev.num_colors++].color_index = color_index;
......@@ -223,6 +219,10 @@ static int ncp5623_probe(struct i2c_client *client)
fwnode_handle_put(mc_node);
return ret;
release_led_node:
fwnode_handle_put(led_node);
goto release_mc_node;
}
static void ncp5623_remove(struct i2c_client *client)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment