From: David Miller <davem@davemloft.net>
To: sainath.grandhi@intel.com
Cc: netdev@vger.kernel.org, mahesh@bandewar.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3 5/7] tap: Extending tap device create/destroy APIs
Date: Tue, 31 Jan 2017 12:51:12 -0500 (EST) [thread overview]
Message-ID: <20170131.125112.287960842388784953.davem@davemloft.net> (raw)
In-Reply-To: <1485803522-16564-6-git-send-email-sainath.grandhi@intel.com>
From: Sainath Grandhi <sainath.grandhi@intel.com>
Date: Mon, 30 Jan 2017 11:12:00 -0800
> + list_for_each_entry_safe(tap_major, tmp, &major_list, next) {
> + if (tap_major->major == major) {
> + return tap_major;
> + }
> + }
Single line basic blocks, such as this 'if' statement, should not be
surrounded by curly braces.
Also I see not mutual exclusion being implemented to protect this
list. If there is, it is not obvious, so it should be documented with
a comment explaining what protects the list.
> @@ -1175,14 +1228,7 @@ int tap_create_cdev(struct cdev *tap_cdev,
> if (err)
> goto out2;
>
> - macvtap_major.major = MAJOR(*tap_major);
> -
> - idr_init(&macvtap_major.minor_idr);
> - mutex_init(&macvtap_major.minor_lock);
> -
> - macvtap_major.device_name = device_name;
> -
> - return err;
> + return tap_list_add(*tap_major, device_name);
>
> out2:
> unregister_chrdev_region(*tap_major, TAP_NUM_DEVS);
If tap_list_add() fails, you will leave the chrdev region registered.
next prev parent reply other threads:[~2017-01-31 17:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 19:11 [PATCHv3 0/7] Refactor macvtap to re-use tap functionality by other virtual intefaces Sainath Grandhi
2017-01-30 19:11 ` [PATCHv3 1/7] tap: Refactoring macvtap.c Sainath Grandhi
2017-01-30 19:11 ` [PATCHv3 2/7] tap: Renaming tap related APIs, data structures, macros Sainath Grandhi
2017-01-30 19:11 ` [PATCHv3 3/7] tap: Tap character device creation/destroy API Sainath Grandhi
2017-01-30 19:11 ` [PATCHv3 4/7] tap: Abstract type of virtual interface from tap implementation Sainath Grandhi
2017-01-30 19:12 ` [PATCHv3 5/7] tap: Extending tap device create/destroy APIs Sainath Grandhi
2017-01-31 17:51 ` David Miller [this message]
2017-02-02 23:22 ` Grandhi, Sainath
2017-01-30 19:12 ` [PATCHv3 6/7] tap: tap as an independent module Sainath Grandhi
2017-01-30 19:12 ` [PATCHv3 7/7] ipvtap: IP-VLAN based tap driver Sainath Grandhi
-- strict thread matches above, loose matches on Subject: below --
2017-01-25 21:25 [PATCHv3 0/7] Refactor macvtap to re-use tap functionality by other virtual intefaces Sainath Grandhi
2017-01-25 21:25 ` [PATCHv3 5/7] TAP: Extending tap device create/destroy APIs Sainath Grandhi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170131.125112.287960842388784953.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mahesh@bandewar.net \
--cc=netdev@vger.kernel.org \
--cc=sainath.grandhi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).