Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7b2185747c32260a3e43b94812e96d22a8725f09
Commit:     7b2185747c32260a3e43b94812e96d22a8725f09
Parent:     dce5cbeec32eb5db4d406b732b1256c6f702bde5
Author:     Denis V. Lunev <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 31 18:47:00 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Jan 31 19:28:38 2008 -0800

    [IPV4]: Small style cleanup of the error path in rtm_to_ifaddr.
    
    Remove error code assignment inside brackets on failure. The code
    looks better if the error is assigned before condition check. Also,
    the compiler treats this better.
    
    Signed-off-by: Denis V. Lunev <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/devinet.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5ab5acc..3376d63 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -492,39 +492,34 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr 
*nlh)
        struct ifaddrmsg *ifm;
        struct net_device *dev;
        struct in_device *in_dev;
-       int err = -EINVAL;
+       int err;
 
        err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy);
        if (err < 0)
                goto errout;
 
        ifm = nlmsg_data(nlh);
-       if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) {
-               err = -EINVAL;
+       err = -EINVAL;
+       if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL)
                goto errout;
-       }
 
        dev = __dev_get_by_index(&init_net, ifm->ifa_index);
-       if (dev == NULL) {
-               err = -ENODEV;
+       err = -ENODEV;
+       if (dev == NULL)
                goto errout;
-       }
 
        in_dev = __in_dev_get_rtnl(dev);
-       if (in_dev == NULL) {
-               err = -ENOBUFS;
+       err = -ENOBUFS;
+       if (in_dev == NULL)
                goto errout;
-       }
 
        ifa = inet_alloc_ifa();
-       if (ifa == NULL) {
+       if (ifa == NULL)
                /*
                 * A potential indev allocation can be left alive, it stays
                 * assigned to its device and is destroy with it.
                 */
-               err = -ENOBUFS;
                goto errout;
-       }
 
        ipv4_devconf_setall(in_dev);
        in_dev_hold(in_dev);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to