tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Dead code: double return



Hi,
my code scanner reports in several places lines like these:

        return ERROR_CODE/func(XXX);
        return VALUE;

Of course the latter is never reached; is there a special syntax meaning behind
this? It's ok if I fix them all? I put here [1] those which seem obvious and
harmless.

Also, I get several

        panic(XX);
        return;/break;/continue;

in many places; it's ok if I start removing these return;/break;/continue;?

Maxime

[1]:

Index: arch/arm/s3c2xx0/s3c24x0_lcd.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/s3c2xx0/s3c24x0_lcd.c,v
retrieving revision 1.11
diff -u -r1.11 s3c24x0_lcd.c
--- arch/arm/s3c2xx0/s3c24x0_lcd.c      10 Mar 2014 04:25:51 -0000      1.11
+++ arch/arm/s3c2xx0/s3c24x0_lcd.c      17 Aug 2014 17:05:13 -0000
@@ -735,7 +735,6 @@
            offset, prot, BUS_DMA_WAITOK|BUS_DMA_COHERENT);
        /*      printf("s3c24x0_lcd_mmap: ret: %lx\n", ret);*/
        return ret;
-       return -1;
 }
 
 
Index: compat/netbsd32/netbsd32_compat_50.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_compat_50.c,v
retrieving revision 1.24
diff -u -r1.24 netbsd32_compat_50.c
--- compat/netbsd32/netbsd32_compat_50.c        24 Jun 2014 14:33:57 -0000      
1.24
+++ compat/netbsd32/netbsd32_compat_50.c        17 Aug 2014 17:05:19 -0000
@@ -139,7 +139,6 @@
 
        return selcommon(retval, SCARG(uap, nd), SCARG_P32(uap, in),
            SCARG_P32(uap, ou), SCARG_P32(uap, ex), ts, NULL);
-       return 0;
 }
 
 int
@@ -563,7 +562,6 @@
 
        return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp,
            SCARG_P32(uap, hint));
-       return 0;
 }
 
 static int
@@ -681,7 +679,6 @@
 
        return selcommon(retval, SCARG(uap, nd), SCARG_P32(uap, in),
            SCARG_P32(uap, ou), SCARG_P32(uap, ex), ts, mask);
-       return 0;
 }
 
 int
Index: compat/netbsd32/netbsd32_compat_60.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_compat_60.c,v
retrieving revision 1.1
diff -u -r1.1 netbsd32_compat_60.c
--- compat/netbsd32/netbsd32_compat_60.c        29 Mar 2013 01:13:54 -0000      
1.1
+++ compat/netbsd32/netbsd32_compat_60.c        17 Aug 2014 17:05:19 -0000
@@ -83,5 +83,4 @@
 
        return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp,
            SCARG_P32(uap, hint));
-       return 0;
 }
Index: compat/osf1/osf1_mount.c
===================================================================
RCS file: /cvsroot/src/sys/compat/osf1/osf1_mount.c,v
retrieving revision 1.50
diff -u -r1.50 osf1_mount.c
--- compat/osf1/osf1_mount.c    27 Nov 2013 17:24:44 -0000      1.50
+++ compat/osf1/osf1_mount.c    17 Aug 2014 17:05:19 -0000
@@ -314,6 +314,4 @@
 
        return do_sys_mount(l, vfs_getopsbyname("nfs"), NULL, SCARG(uap, path),
            SCARG(uap, flags), &bsd_na, UIO_SYSSPACE, sizeof bsd_na, &dummy);
-
-       return 0;
 }
Index: fs/ptyfs/ptyfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/ptyfs/ptyfs_vnops.c,v
retrieving revision 1.48
diff -u -r1.48 ptyfs_vnops.c
--- fs/ptyfs/ptyfs_vnops.c      13 Aug 2014 14:10:00 -0000      1.48
+++ fs/ptyfs/ptyfs_vnops.c      17 Aug 2014 17:05:23 -0000
@@ -577,8 +577,6 @@
            KAUTH_ACCESS_ACTION(ap->a_mode, ap->a_vp->v_type, va.va_mode),
            ap->a_vp, NULL, genfs_can_access(va.va_type, va.va_mode, va.va_uid,
            va.va_gid, ap->a_mode, ap->a_cred));
-
-       return error;
 }
 
 /*


Home | Main Index | Thread Index | Old Index