.. | .. |
---|
572 | 572 | link->local_id = fwep.id; |
---|
573 | 573 | link->local_port = fwep.port; |
---|
574 | 574 | link->local_node = fwnode_graph_get_port_parent(fwnode); |
---|
| 575 | + if (!link->local_node) |
---|
| 576 | + return -ENOLINK; |
---|
575 | 577 | |
---|
576 | 578 | fwnode = fwnode_graph_get_remote_endpoint(fwnode); |
---|
577 | | - if (!fwnode) { |
---|
578 | | - fwnode_handle_put(fwnode); |
---|
579 | | - return -ENOLINK; |
---|
580 | | - } |
---|
| 579 | + if (!fwnode) |
---|
| 580 | + goto err_put_local_node; |
---|
581 | 581 | |
---|
582 | 582 | fwnode_graph_parse_endpoint(fwnode, &fwep); |
---|
583 | 583 | link->remote_id = fwep.id; |
---|
584 | 584 | link->remote_port = fwep.port; |
---|
585 | 585 | link->remote_node = fwnode_graph_get_port_parent(fwnode); |
---|
| 586 | + if (!link->remote_node) |
---|
| 587 | + goto err_put_remote_endpoint; |
---|
586 | 588 | |
---|
587 | 589 | return 0; |
---|
| 590 | + |
---|
| 591 | +err_put_remote_endpoint: |
---|
| 592 | + fwnode_handle_put(fwnode); |
---|
| 593 | + |
---|
| 594 | +err_put_local_node: |
---|
| 595 | + fwnode_handle_put(link->local_node); |
---|
| 596 | + |
---|
| 597 | + return -ENOLINK; |
---|
588 | 598 | } |
---|
589 | 599 | EXPORT_SYMBOL_GPL(v4l2_fwnode_parse_link); |
---|
590 | 600 | |
---|