diff options
Diffstat (limited to 'drivers/firewire/fw-topology.c')
-rw-r--r-- | drivers/firewire/fw-topology.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index 39e5cd12aa52..0fc9b000e99d 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -152,6 +152,10 @@ static void update_hop_count(struct fw_node *node) | |||
152 | node->max_hops = max(max_child_hops, depths[0] + depths[1] + 2); | 152 | node->max_hops = max(max_child_hops, depths[0] + depths[1] + 2); |
153 | } | 153 | } |
154 | 154 | ||
155 | static inline struct fw_node *fw_node(struct list_head *l) | ||
156 | { | ||
157 | return list_entry(l, struct fw_node, link); | ||
158 | } | ||
155 | 159 | ||
156 | /** | 160 | /** |
157 | * build_tree - Build the tree representation of the topology | 161 | * build_tree - Build the tree representation of the topology |
@@ -162,7 +166,7 @@ static void update_hop_count(struct fw_node *node) | |||
162 | * This function builds the tree representation of the topology given | 166 | * This function builds the tree representation of the topology given |
163 | * by the self IDs from the latest bus reset. During the construction | 167 | * by the self IDs from the latest bus reset. During the construction |
164 | * of the tree, the function checks that the self IDs are valid and | 168 | * of the tree, the function checks that the self IDs are valid and |
165 | * internally consistent. On succcess this funtions returns the | 169 | * internally consistent. On succcess this function returns the |
166 | * fw_node corresponding to the local card otherwise NULL. | 170 | * fw_node corresponding to the local card otherwise NULL. |
167 | */ | 171 | */ |
168 | static struct fw_node *build_tree(struct fw_card *card, | 172 | static struct fw_node *build_tree(struct fw_card *card, |
@@ -211,6 +215,10 @@ static struct fw_node *build_tree(struct fw_card *card, | |||
211 | */ | 215 | */ |
212 | for (i = 0, h = &stack; i < child_port_count; i++) | 216 | for (i = 0, h = &stack; i < child_port_count; i++) |
213 | h = h->prev; | 217 | h = h->prev; |
218 | /* | ||
219 | * When the stack is empty, this yields an invalid value, | ||
220 | * but that pointer will never be dereferenced. | ||
221 | */ | ||
214 | child = fw_node(h); | 222 | child = fw_node(h); |
215 | 223 | ||
216 | node = fw_node_create(q, port_count, card->color); | 224 | node = fw_node_create(q, port_count, card->color); |