Merge commit 'origin/master' into next
[sfrench/cifs-2.6.git] / net / ax25 / ax25_iface.c
index 16be0c14780a18415bf203f617b8cb1c4cdb0808..71338f112108a06ee9b3734d19c7146c54fea7a9 100644 (file)
@@ -61,29 +61,24 @@ void ax25_protocol_release(unsigned int pid)
 
        write_lock_bh(&protocol_list_lock);
        protocol = protocol_list;
-       if (protocol == NULL) {
-               write_unlock_bh(&protocol_list_lock);
-               return;
-       }
+       if (protocol == NULL)
+               goto out;
 
        if (protocol->pid == pid) {
                protocol_list = protocol->next;
-               write_unlock_bh(&protocol_list_lock);
-               kfree(protocol);
-               return;
+               goto out;
        }
 
        while (protocol != NULL && protocol->next != NULL) {
                if (protocol->next->pid == pid) {
                        s = protocol->next;
                        protocol->next = protocol->next->next;
-                       write_unlock_bh(&protocol_list_lock);
-                       kfree(s);
-                       return;
+                       goto out;
                }
 
                protocol = protocol->next;
        }
+out:
        write_unlock_bh(&protocol_list_lock);
 }