X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=net%2Fnetrom%2Fnr_route.c;h=8e6bd4e9d82c76e929ce1648c51456ce9da6e60f;hb=98b96173c777c67daaa7d163a35e591e1928a164;hp=0096105bcd479292efe95ad651f7d6b52c08cf36;hpb=c4366889dda8110247be59ca41fddb82951a8c26;p=cascardo%2Flinux.git diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index 0096105bcd47..8e6bd4e9d82c 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -87,8 +86,9 @@ static void nr_remove_neigh(struct nr_neigh *); * Add a new route to a node, and in the process add the node and the * neighbour if it is new. */ -static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax25, - ax25_digi *ax25_digi, struct net_device *dev, int quality, int obs_count) +static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic, + ax25_address *ax25, ax25_digi *ax25_digi, struct net_device *dev, + int quality, int obs_count) { struct nr_node *nr_node; struct nr_neigh *nr_neigh; @@ -406,7 +406,8 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n /* * Lock a neighbour with a quality. */ -static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality) +static int __must_check nr_add_neigh(ax25_address *callsign, + ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality) { struct nr_neigh *nr_neigh; @@ -777,9 +778,13 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) nr_src = (ax25_address *)(skb->data + 0); nr_dest = (ax25_address *)(skb->data + 7); - if (ax25 != NULL) - nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat, - ax25->ax25_dev->dev, 0, sysctl_netrom_obsolescence_count_initialiser); + if (ax25 != NULL) { + ret = nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat, + ax25->ax25_dev->dev, 0, + sysctl_netrom_obsolescence_count_initialiser); + if (ret) + return ret; + } if ((dev = nr_dev_get(nr_dest)) != NULL) { /* Its for me */ if (ax25 == NULL) /* Its from me */ @@ -844,6 +849,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) ret = (nr_neigh->ax25 != NULL); nr_node_unlock(nr_node); nr_node_put(nr_node); + return ret; } @@ -854,8 +860,8 @@ static void *nr_node_start(struct seq_file *seq, loff_t *pos) struct nr_node *nr_node; struct hlist_node *node; int i = 1; - - spin_lock_bh(&nr_node_list_lock); + + spin_lock_bh(&nr_node_list_lock); if (*pos == 0) return SEQ_START_TOKEN; @@ -872,8 +878,8 @@ static void *nr_node_next(struct seq_file *seq, void *v, loff_t *pos) { struct hlist_node *node; ++*pos; - - node = (v == SEQ_START_TOKEN) + + node = (v == SEQ_START_TOKEN) ? nr_node_list.first : ((struct nr_node *)v)->node_node.next; @@ -927,7 +933,7 @@ static int nr_node_info_open(struct inode *inode, struct file *file) return seq_open(file, &nr_node_seqops); } -struct file_operations nr_nodes_fops = { +const struct file_operations nr_nodes_fops = { .owner = THIS_MODULE, .open = nr_node_info_open, .read = seq_read, @@ -956,8 +962,8 @@ static void *nr_neigh_next(struct seq_file *seq, void *v, loff_t *pos) { struct hlist_node *node; ++*pos; - - node = (v == SEQ_START_TOKEN) + + node = (v == SEQ_START_TOKEN) ? nr_neigh_list.first : ((struct nr_neigh *)v)->neigh_node.next; @@ -990,7 +996,7 @@ static int nr_neigh_show(struct seq_file *seq, void *v) if (nr_neigh->digipeat != NULL) { for (i = 0; i < nr_neigh->digipeat->ndigi; i++) - seq_printf(seq, " %s", + seq_printf(seq, " %s", ax2asc(buf, &nr_neigh->digipeat->calls[i])); } @@ -1011,7 +1017,7 @@ static int nr_neigh_info_open(struct inode *inode, struct file *file) return seq_open(file, &nr_neigh_seqops); } -struct file_operations nr_neigh_fops = { +const struct file_operations nr_neigh_fops = { .owner = THIS_MODULE, .open = nr_neigh_info_open, .read = seq_read,