On 15/02/17 21:02, Eric Dumazet wrote:
On Wed, 2017-02-15 at 20:25 +0000, Anoob Soman wrote:
+static struct packet_fanout *fanout_release(struct sock *sk)
{
struct packet_sock *po = pkt_sk(sk);
struct packet_fanout *f;
@@ -1728,17 +1736,17 @@ static void fanout_release(struct sock *sk)
if (f) {
po->fanout = NULL;
- if (atomic_dec_and_test(&f->sk_ref)) {
+ if (atomic_dec_and_test(&f->sk_ref))
list_del(&f->list);
- dev_remove_pack(&f->prot_hook);
- fanout_release_data(f);
- kfree(f);
- }
+ else
+ f = NULL;
Patch looks good, except this coding style issue.
if (...) {
multi lines;
expressions;
} else {
f = NULL;
}
Not :
if (...) {
multi lines;
expressions;
} else
f = NULL;
If statement looks like this.
if (atomic_dec_and_test(sk_ref))
list_del(f->list);
else
f = NULL;
there are no multiple lines under if.