Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

R Sundar and committed by
Greg Kroah-Hartman
0a01aec2 c3f38fa6

+34 -32
+34 -32
drivers/usb/typec/mux/nb7vpq904m.c
··· 321 321 322 322 ep = of_graph_get_endpoint_by_regs(nb7->client->dev.of_node, 1, 0); 323 323 324 - if (ep) { 325 - ret = of_property_count_u32_elems(ep, "data-lanes"); 326 - if (ret == -EINVAL) 327 - /* Property isn't here, consider default mapping */ 328 - goto out_done; 329 - if (ret < 0) 330 - goto out_error; 324 + if (!ep) 325 + return 0; 331 326 332 - if (ret != DATA_LANES_COUNT) { 333 - dev_err(&nb7->client->dev, "expected 4 data lanes\n"); 334 - ret = -EINVAL; 335 - goto out_error; 336 - } 337 327 338 - ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT); 339 - if (ret) 340 - goto out_error; 328 + ret = of_property_count_u32_elems(ep, "data-lanes"); 329 + if (ret == -EINVAL) 330 + /* Property isn't here, consider default mapping */ 331 + goto out_done; 332 + if (ret < 0) 333 + goto out_error; 341 334 342 - for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) { 343 - for (j = 0; j < DATA_LANES_COUNT; j++) { 344 - if (data_lanes[j] != supported_data_lane_mapping[i][j]) 345 - break; 346 - } 335 + if (ret != DATA_LANES_COUNT) { 336 + dev_err(&nb7->client->dev, "expected 4 data lanes\n"); 337 + ret = -EINVAL; 338 + goto out_error; 339 + } 347 340 348 - if (j == DATA_LANES_COUNT) 341 + ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT); 342 + if (ret) 343 + goto out_error; 344 + 345 + for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) { 346 + for (j = 0; j < DATA_LANES_COUNT; j++) { 347 + if (data_lanes[j] != supported_data_lane_mapping[i][j]) 349 348 break; 350 349 } 351 350 352 - switch (i) { 353 - case NORMAL_LANE_MAPPING: 351 + if (j == DATA_LANES_COUNT) 354 352 break; 355 - case INVERT_LANE_MAPPING: 356 - nb7->swap_data_lanes = true; 357 - dev_info(&nb7->client->dev, "using inverted data lanes mapping\n"); 358 - break; 359 - default: 360 - dev_err(&nb7->client->dev, "invalid data lanes mapping\n"); 361 - ret = -EINVAL; 362 - goto out_error; 363 - } 353 + } 354 + 355 + switch (i) { 356 + case NORMAL_LANE_MAPPING: 357 + break; 358 + case INVERT_LANE_MAPPING: 359 + nb7->swap_data_lanes = true; 360 + dev_info(&nb7->client->dev, "using inverted data lanes mapping\n"); 361 + break; 362 + default: 363 + dev_err(&nb7->client->dev, "invalid data lanes mapping\n"); 364 + ret = -EINVAL; 365 + goto out_error; 364 366 } 365 367 366 368 out_done: