kernel: Save some indent here and there and some small cleanup.
authorSascha Wildner <saw@online.de>
Thu, 9 Jun 2016 18:12:00 +0000 (20:12 +0200)
committerSascha Wildner <saw@online.de>
Thu, 9 Jun 2016 18:12:12 +0000 (20:12 +0200)
All these are related to an inspection of the places where we do:

if (...) {
   ...
   goto blah;
} else {
   ...
}

in which case the 'else' is not needed.

I only changed places where I thought that it improves readability or
is just as readable without the 'else'.

sys/emulation/43bsd/43bsd_socket.c
sys/net/altq/altq_rmclass.c
sys/netinet/ip_input.c
sys/platform/pc64/x86_64/mp_machdep.c
sys/vfs/hpfs/hpfs_vfsops.c
sys/vfs/nfs/nfs_serv.c

index 308ecde..b60c9d6 100644 (file)
@@ -293,12 +293,11 @@ sys_osendmsg(struct osendmsg_args *uap)
                if (control == NULL) {
                        error = ENOBUFS;
                        goto cleanup;
-               } else {
-                       cm = mtod(control, struct cmsghdr *);
-                       cm->cmsg_len = control->m_len;
-                       cm->cmsg_level = SOL_SOCKET;
-                       cm->cmsg_type = SCM_RIGHTS;
                }
+               cm = mtod(control, struct cmsghdr *);
+               cm->cmsg_len = control->m_len;
+               cm->cmsg_level = SOL_SOCKET;
+               cm->cmsg_type = SCM_RIGHTS;
        }
 
        get_mplock();
index 6f2d8e9..73c601e 100644 (file)
@@ -955,11 +955,9 @@ _rmc_wrr_dequeue_next(struct rm_ifdat *ifd, int op)
                ifd->pollcache_ = NULL;
                goto _wrr_out;
        }
-       else {
-               /* mode == ALTDQ_POLL || pollcache == NULL */
-               ifd->pollcache_ = NULL;
-               ifd->borrowed_[ifd->qi_] = NULL;
-       }
+       /* mode == ALTDQ_POLL || pollcache == NULL */
+       ifd->pollcache_ = NULL;
+       ifd->borrowed_[ifd->qi_] = NULL;
 #ifdef ADJUST_CUTOFF
  _again:
 #endif
@@ -1118,11 +1116,10 @@ _rmc_prr_dequeue_next(struct rm_ifdat *ifd, int op)
                cpri = cl->pri_;
                ifd->pollcache_ = NULL;
                goto _prr_out;
-       } else {
-               /* mode == ALTDQ_POLL || pollcache == NULL */
-               ifd->pollcache_ = NULL;
-               ifd->borrowed_[ifd->qi_] = NULL;
        }
+       /* mode == ALTDQ_POLL || pollcache == NULL */
+       ifd->pollcache_ = NULL;
+       ifd->borrowed_[ifd->qi_] = NULL;
 #ifdef ADJUST_CUTOFF
  _again:
 #endif
index 51ed86d..0f635ae 100644 (file)
@@ -1138,9 +1138,8 @@ found:
                fp->ipq_frags = m;
                m->m_nextpkt = NULL;
                goto inserted;
-       } else {
-               fp->ipq_nfrags++;
        }
+       fp->ipq_nfrags++;
 
 #define        GETIP(m)        ((struct ip*)((m)->m_pkthdr.header))
 
@@ -2051,9 +2050,8 @@ ip_forward(struct mbuf *m, boolean_t using_srcrt, struct sockaddr_in *next_hop)
                        if (mtemp)
                                ipflow_create(&fwd_ro, mtemp);
                        goto done;
-               } else {
-                       ipstat.ips_redirectsent++;
                }
+               ipstat.ips_redirectsent++;
        } else {
                ipstat.ips_cantforward++;
        }
index 2461763..f08c03c 100644 (file)
@@ -1419,31 +1419,25 @@ detect_cpu_topology(void)
        static int topology_detected = 0;
        int count = 0;
        
-       if (topology_detected) {
+       if (topology_detected)
                goto OUT;
-       }
-       
        if ((cpu_feature & CPUID_HTT) == 0) {
                core_bits = 0;
                logical_CPU_bits = 0;
                goto OUT;
-       } else {
-               count = (cpu_procinfo & CPUID_HTT_CORES)
-                   >> CPUID_HTT_CORE_SHIFT;
-       }       
+       }
+       count = (cpu_procinfo & CPUID_HTT_CORES) >> CPUID_HTT_CORE_SHIFT;
 
-       if (cpu_vendor_id == CPU_VENDOR_INTEL) {
+       if (cpu_vendor_id == CPU_VENDOR_INTEL)
                detect_intel_topology(count);   
-       } else if (cpu_vendor_id == CPU_VENDOR_AMD) {
+       else if (cpu_vendor_id == CPU_VENDOR_AMD)
                detect_amd_topology(count);
-       }
+       topology_detected = 1;
 
 OUT:
        if (bootverbose)
                kprintf("Bits within APICID: logical_CPU_bits: %d; core_bits: %d\n",
                    logical_CPU_bits, core_bits);
-
-       topology_detected = 1;
 }
 
 /* Interface functions to calculate chip_ID,
index aa51e6f..470fd43 100644 (file)
@@ -151,13 +151,11 @@ hpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
                                kprintf("hpfs_mount: vfs_export failed %d\n",
                                        error);
                        }
-                       goto success;
                } else {
                        dprintf(("name [FAILED]\n"));
                        error = EINVAL;
-                       goto success;
                }
-               dprintf(("\n"));
+               goto success;
        }
 
        /*
index 34be3c1..1c87c78 100644 (file)
@@ -468,10 +468,9 @@ out:
                                 postat_ret, vap);
                error = 0;
                goto nfsmout;
-       } else {
-               fp = nfsm_build(&info, NFSX_V2FATTR);
-               nfsm_srvfattr(nfsd, vap, fp);
        }
+       fp = nfsm_build(&info, NFSX_V2FATTR);
+       nfsm_srvfattr(nfsd, vap, fp);
        /* fall through */
 
 nfsmout: