mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
usb: typec: nb7vpq904m: Remove unneeded indentation
In function nb7vpq904m_parse_data_lanes_mapping(), the "if (ep)" condition is basically the entire function. Making the code a bit more readable by inverting the condition so that the function returns immediately if there is no "ep". Signed-off-by: R Sundar <prosunofficial@gmail.com> Link: https://lore.kernel.org/r/20240506162829.5223-1-prosunofficial@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c3f38fa61a
commit
0a01aec24e
|
|
@ -321,46 +321,48 @@ static int nb7vpq904m_parse_data_lanes_mapping(struct nb7vpq904m *nb7)
|
|||
|
||||
ep = of_graph_get_endpoint_by_regs(nb7->client->dev.of_node, 1, 0);
|
||||
|
||||
if (ep) {
|
||||
ret = of_property_count_u32_elems(ep, "data-lanes");
|
||||
if (ret == -EINVAL)
|
||||
/* Property isn't here, consider default mapping */
|
||||
goto out_done;
|
||||
if (ret < 0)
|
||||
goto out_error;
|
||||
if (!ep)
|
||||
return 0;
|
||||
|
||||
if (ret != DATA_LANES_COUNT) {
|
||||
dev_err(&nb7->client->dev, "expected 4 data lanes\n");
|
||||
ret = -EINVAL;
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT);
|
||||
if (ret)
|
||||
goto out_error;
|
||||
ret = of_property_count_u32_elems(ep, "data-lanes");
|
||||
if (ret == -EINVAL)
|
||||
/* Property isn't here, consider default mapping */
|
||||
goto out_done;
|
||||
if (ret < 0)
|
||||
goto out_error;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) {
|
||||
for (j = 0; j < DATA_LANES_COUNT; j++) {
|
||||
if (data_lanes[j] != supported_data_lane_mapping[i][j])
|
||||
break;
|
||||
}
|
||||
if (ret != DATA_LANES_COUNT) {
|
||||
dev_err(&nb7->client->dev, "expected 4 data lanes\n");
|
||||
ret = -EINVAL;
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
if (j == DATA_LANES_COUNT)
|
||||
ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT);
|
||||
if (ret)
|
||||
goto out_error;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) {
|
||||
for (j = 0; j < DATA_LANES_COUNT; j++) {
|
||||
if (data_lanes[j] != supported_data_lane_mapping[i][j])
|
||||
break;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case NORMAL_LANE_MAPPING:
|
||||
if (j == DATA_LANES_COUNT)
|
||||
break;
|
||||
case INVERT_LANE_MAPPING:
|
||||
nb7->swap_data_lanes = true;
|
||||
dev_info(&nb7->client->dev, "using inverted data lanes mapping\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(&nb7->client->dev, "invalid data lanes mapping\n");
|
||||
ret = -EINVAL;
|
||||
goto out_error;
|
||||
}
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case NORMAL_LANE_MAPPING:
|
||||
break;
|
||||
case INVERT_LANE_MAPPING:
|
||||
nb7->swap_data_lanes = true;
|
||||
dev_info(&nb7->client->dev, "using inverted data lanes mapping\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(&nb7->client->dev, "invalid data lanes mapping\n");
|
||||
ret = -EINVAL;
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
out_done:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user