shithub: riscv

Download patch

ref: c325c491f61696e81ab0ee9e6aea840c3636ed3d
parent: 29b1f55e7390043efef033578083694fb85dbe99
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 28 13:54:31 EST 2024

kernel: Use _Noreturn for gotolabel(), error(), nexterror() and panic()

--- a/sys/src/9/arm64/devrtc.c
+++ b/sys/src/9/arm64/devrtc.c
@@ -76,7 +76,6 @@
 		return readnum(offset, buf, n, rtctime(), 12);
 	}
 	error(Ebadarg);
-	return 0;
 }
 
 static long	 
@@ -83,7 +82,6 @@
 rtcwrite(Chan*, void*, long, vlong)
 {
 	error(Eperm);
-	return 0;
 }
 
 Dev rtcdevtab = {
--- a/sys/src/9/arm64/gic.c
+++ b/sys/src/9/arm64/gic.c
@@ -106,7 +106,6 @@
 		rregs += (0x20000/4);
 	}
 	panic("getrregs: no re-distributor for cpu %d\n", machno);
-	return nil;
 }
 
 void
--- a/sys/src/9/arm64/mmu.c
+++ b/sys/src/9/arm64/mmu.c
@@ -23,7 +23,6 @@
 	if((uintptr)va >= KZERO)
 		return (uintptr)va-KZERO;
 	panic("paddr: va=%#p pc=%#p", va, getcallerpc(&va));
-	return 0;
 }
 
 uintptr
@@ -40,7 +39,6 @@
 	if(pa < (uintptr)-KZERO)
 		return (void*)(pa + KZERO);
 	panic("kaddr: pa=%#p pc=%#p", pa, getcallerpc(&pa));
-	return nil;
 }
 
 static void*
--- a/sys/src/9/bcm/devarch.c
+++ b/sys/src/9/bcm/devarch.c
@@ -108,8 +108,6 @@
 		error(Eperm);
 		break;
 	}
-
-	return 0;
 }
 
 static long
@@ -120,8 +118,6 @@
 	if(c->qid.path < narchdir && (fn = writefn[c->qid.path]))
 		return fn(c, a, n, offset);
 	error(Eperm);
-
-	return 0;
 }
 
 void archinit(void);
--- a/sys/src/9/bcm/ether4330.c
+++ b/sys/src/9/bcm/ether4330.c
@@ -993,7 +993,6 @@
 		c = namec(nbuf, Aopen, OREAD, 0);
 		poperror();
 	}else{
-		c = nil;
 		snprint(up->genbuf, sizeof up->genbuf, "can't find %s in /boot or /lib/firmware", file);
 		error(up->genbuf);
 	}
--- a/sys/src/9/bcm/usbdwc.c
+++ b/sys/src/9/bcm/usbdwc.c
@@ -802,7 +802,6 @@
 	switch(ep->ttype){
 	default:
 		error("endpoint type not supported");
-		return;
 	case Tintr:
 		assert(ep->pollival > 0);
 		/* fall through */
--- a/sys/src/9/cycv/devarch.c
+++ b/sys/src/9/cycv/devarch.c
@@ -209,7 +209,6 @@
 		return devdirread(c, a, n, archdir, narchdir, devgen);
 	default:
 		error(Egreg);
-		return -1;
 	}
 }
 
@@ -222,7 +221,6 @@
 		return n;
 	default:
 		error(Egreg);
-		return -1;
 	}
 }
 
--- a/sys/src/9/cycv/mmu.c
+++ b/sys/src/9/cycv/mmu.c
@@ -231,7 +231,6 @@
 	if((uintptr)v >= KZERO)
 		return (uintptr)v-KZERO;
 	panic("paddr: va=%#p pc=%#p", v, getcallerpc(&v));
-	return 0;
 }
 
 void *
@@ -242,7 +241,6 @@
 	if(u < (uintptr)-KZERO)
 		return (void *)(u + KZERO);
 	panic("kaddr: pa=%#p pc=%#p", u, getcallerpc(&u));
-	return nil;
 }
 
 uintptr
@@ -296,7 +294,6 @@
 			return (KMap *) (KMAP + i * BY2PG);
 		}
 	panic("out of kmap");
-	return nil;
 }
 
 void
@@ -346,7 +343,6 @@
 			return (void *) ((u - ub) * BY2PG + TMAP);
 		}
 	panic("tmpmap: full (pa=%#.8lux)", pa);
-	return nil;
 }
 
 void
--- a/sys/src/9/imx8/ccm.c
+++ b/sys/src/9/imx8/ccm.c
@@ -978,9 +978,6 @@
 	u32int cfg0, cfg1;
 	vlong v;
 
-	cfg0 = reg[0];
-	cfg1 = reg[1];
-
 	error = freq;
 	for(divq = 2; divq <= 64; divq += 2){
 		for(divr = 2; divr <= 64; divr++){
@@ -1113,7 +1110,6 @@
 		if(anapllout_input[mux].input == input)
 			goto Muxok;
 	panic("setanapllout: bad input clock\n");
-	return;
 Muxok:
 	anatop[CCM_ANALOG_PLLOUT_MONITOR_CFG] = mux;
 	if(freq <= 0)
@@ -1121,7 +1117,6 @@
 	div = input_clk_freq[input] / freq;
 	if(div < 1 || div > 8){
 		panic("setanapllout: divider out of range\n");
-		return;
 	}
 	enablepll(input);
 	reg = anapllout_input[mux].reg;
@@ -1130,7 +1125,6 @@
 		anatop[reg] = (anatop[reg] & ~(7<<shift)) | ((div-1)<<shift);
 	} else if(div != 1){
 		panic("setanapllout: bad frequency\n");
-		return;
 	}
 	anatop[CCM_ANALOG_PLLOUT_MONITOR_CFG] |= PLLOUT_MONITOR_CLK_CKE;
 }
@@ -1444,5 +1438,4 @@
 		return input_clk_freq[input];
 
 	panic("getclkrate: clock %s not defined", name);
-	return -1;
 }
--- a/sys/src/9/imx8/devrtc.c
+++ b/sys/src/9/imx8/devrtc.c
@@ -154,7 +154,6 @@
 		return readnum(offset, buf, n, rtctime(), 12);
 	}
 	error(Ebadarg);
-	return 0;
 }
 
 #define PUTBCD(n,o) bcdclock[o] = (n % 10) | (((n / 10) % 10)<<4)
@@ -204,7 +203,6 @@
 		return n;
 	}
 	error(Ebadarg);
-	return 0;
 }
 
 Dev rtcdevtab = {
--- a/sys/src/9/imx8/gic.c
+++ b/sys/src/9/imx8/gic.c
@@ -106,7 +106,6 @@
 		rregs += (0x20000/4);
 	}
 	panic("getrregs: no re-distributor for cpu %d\n", machno);
-	return nil;
 }
 
 void
--- a/sys/src/9/imx8/iomux.c
+++ b/sys/src/9/imx8/iomux.c
@@ -1036,7 +1036,6 @@
 			goto Padok;
 
 	panic("iomuxpad: %s not defined", pads);
-	return;
 Padok:
 	val = 0;
 	mask = 0;
@@ -1090,7 +1089,6 @@
 				goto Muxok;
 		}
 		panic("iomuxpad: %s not muxable to %s", pads, sel);
-		return;
 Muxok:
 		val = (val & ~MUX_MODE) | alt;
 		mask |= MUX_MODE;
@@ -1101,7 +1099,6 @@
 
 	if(pad < PAD_PMIC_STBY_REQ){
 		panic("iomuxpad: %s has no mux control", pads);
-		return;
 	}
 
 	reg = &iomuxc[IOMUXC_SW_MUX_CTL_PAD_PMIC_STBY_REQ + (pad - PAD_PMIC_STBY_REQ)];
--- a/sys/src/9/ip/arp.c
+++ b/sys/src/9/ip/arp.c
@@ -349,7 +349,6 @@
 		break;
 	default:
 		panic("arpenter: version %d", version);
-		return -1;	/* to supress warnings */
 	}
 
 	if(r == nil || r->ifc != ifc || (r->type & (Rbcast|Rmulti)) != 0)
--- a/sys/src/9/ip/devip.c
+++ b/sys/src/9/ip/devip.c
@@ -488,7 +488,6 @@
 ipcreate(Chan*, char*, int, ulong)
 {
 	error(Eperm);
-	return 0;
 }
 
 static void
--- a/sys/src/9/ip/tcp.c
+++ b/sys/src/9/ip/tcp.c
@@ -2720,7 +2720,6 @@
 			hbp = htontcp6(&seg, bp, &tcb->protohdr.tcp6hdr, tcb);
 			break;
 		default:
-			hbp = nil;	/* to suppress a warning */
 			panic("tcpoutput: version %d", version);
 		}
 
--- a/sys/src/9/ip/udp.c
+++ b/sys/src/9/ip/udp.c
@@ -403,7 +403,6 @@
 		break;
 	default:
 		panic("udpiput: version %d", version);
-		return;	/* to avoid a warning */
 	}
 
 	qlock(udp);
@@ -498,7 +497,6 @@
 		bp = trimblock(bp, UDP6_IPHDR_SZ+UDP_UDPHDR_SZ, len);
 		break;
 	default:
-		bp = nil;
 		panic("udpiput4: version %d", version);
 	}
 	if(bp == nil){
--- a/sys/src/9/kw/devarch.c
+++ b/sys/src/9/kw/devarch.c
@@ -110,8 +110,6 @@
 		error(Eperm);
 		break;
 	}
-
-	return 0;
 }
 
 static long
@@ -122,8 +120,6 @@
 	if(c->qid.path < narchdir && (fn = writefn[c->qid.path]))
 		return fn(c, a, n, offset);
 	error(Eperm);
-
-	return 0;
 }
 
 void archinit(void);
--- a/sys/src/9/kw/ether1116.c
+++ b/sys/src/9/kw/ether1116.c
@@ -999,9 +999,11 @@
 		if(strcmp(cb->f[1], "on") == 0) {
 			/* incoming packet queue doesn't expect jumbo frames */
 			error("jumbo disabled");
+/*
 			reg->psc0 = (reg->psc0 & ~PSC0mrumask) |
 				PSC0mru(PSC0mru9022);
 			e->maxmtu = 9022;
+*/
 		} else if(strcmp(cb->f[1], "off") == 0) {
 			reg->psc0 = (reg->psc0 & ~PSC0mrumask) |
 				PSC0mru(PSC0mru1522);
--- a/sys/src/9/omap/devarch.c
+++ b/sys/src/9/omap/devarch.c
@@ -110,8 +110,6 @@
 		error(Eperm);
 		break;
 	}
-
-	return 0;
 }
 
 static long
@@ -122,8 +120,6 @@
 	if(c->qid.path < narchdir && (fn = writefn[c->qid.path]))
 		return fn(c, a, n, offset);
 	error(Eperm);
-
-	return 0;
 }
 
 void archinit(void);
--- a/sys/src/9/omap/devdss.c
+++ b/sys/src/9/omap/devdss.c
@@ -137,7 +137,6 @@
 	default:
 		error(Egreg);
 	}
-	return 0;
 }
 
 static long
@@ -155,7 +154,6 @@
 	default:
 		error(Egreg);
 	}
-	return 0;
 }
 
 Dev dssdevtab = {
--- a/sys/src/9/pc/devarch.c
+++ b/sys/src/9/pc/devarch.c
@@ -223,7 +223,6 @@
 		if(c->qid.path < narchdir && (fn = readfn[c->qid.path]))
 			return fn(c, a, n, offset);
 		error(Eperm);
-		return 0;
 	}
 }
 
@@ -279,7 +278,6 @@
 		error(Eperm);
 		break;
 	}
-	return 0;
 }
 
 Dev archdevtab = {
--- a/sys/src/9/pc/devfloppy.c
+++ b/sys/src/9/pc/devfloppy.c
@@ -388,7 +388,6 @@
 	if(c->qid.type & QTDIR)
 		return devdirread(c, a, n, floppydir, 1+fl.ndrive*NFDIR, devgen);
 
-	rv = 0;
 	dp = &fl.d[c->qid.path & ~Qmask];
 	switch ((int)(c->qid.path & Qmask)) {
 	case Qdata:
@@ -439,7 +438,6 @@
 	Cmdtab *ct;
 	ulong offset = off;
 
-	rv = 0;
 	dp = &fl.d[c->qid.path & ~Qmask];
 	switch ((int)(c->qid.path & Qmask)) {
 	case Qdata:
--- a/sys/src/9/pc/devi82365.c
+++ b/sys/src/9/pc/devi82365.c
@@ -802,7 +802,6 @@
 		return n;
 	}
 	error(Ebadarg);
-	return -1;	/* not reached */
 }
 
 static long
@@ -877,7 +876,6 @@
 		return n;
 	}
 	error(Ebadarg);
-	return -1;	/* not reached */
 }
 
 Dev i82365devtab = {
--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -349,7 +349,6 @@
 	if(c->qid.path == Qdir)
 		return devdirread(c, a, n, kbdtab, nelem(kbdtab), devgen);
 	error(Egreg);
-	return 0;
 }
 
 static long
--- a/sys/src/9/pc/devrtc.c
+++ b/sys/src/9/pc/devrtc.c
@@ -215,7 +215,6 @@
 		return t - offset;
 	}
 	error(Ebadarg);
-	return 0;
 }
 
 #define PUTBCD(n,o) bcdclock[o] = (n % 10) | (((n / 10) % 10)<<4)
@@ -298,7 +297,6 @@
 		return t - offset;
 	}
 	error(Ebadarg);
-	return 0;
 }
 
 Dev rtcdevtab = {
--- a/sys/src/9/pc/devvga.c
+++ b/sys/src/9/pc/devvga.c
@@ -177,8 +177,6 @@
 		error(Egreg);
 		break;
 	}
-
-	return 0;
 }
 
 static char Ebusy[] = "vga already configured";
@@ -416,8 +414,6 @@
 		error(Egreg);
 		break;
 	}
-
-	return 0;
 }
 
 Dev vgadevtab = {
--- a/sys/src/9/pc/devvmx.c
+++ b/sys/src/9/pc/devvmx.c
@@ -1201,7 +1201,6 @@
 	
 	cmdrelease(p, 0);
 	pexit(Equit, 1);
-	return 0;
 }
 
 static void
@@ -2118,7 +2117,6 @@
 		error(Egreg);
 		break;
 	}
-	return 0;
 }
 
 static long
--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -425,7 +425,6 @@
 	
 	if(mii(ctlr->mii, (1<<1)) == 0 || (phy = ctlr->mii->curphy) == nil){
 		error("no phy");
-		return;
 	}
 
 	print("#l%d: rtl8169: oui %#ux phyno %d, macv = %#8.8ux phyv = %#4.4ux\n",
--- a/sys/src/9/pc/ether82598.c
+++ b/sys/src/9/pc/ether82598.c
@@ -402,7 +402,6 @@
 ctl(Ether *, void *, long)
 {
 	error(Ebadarg);
-	return -1;
 }
 
 #define Next(x, m)	(((x)+1) & (m))
--- a/sys/src/9/pc/etherx550.c
+++ b/sys/src/9/pc/etherx550.c
@@ -365,7 +365,6 @@
 ctl(Ether *, void *, long)
 {
 	error(Ebadarg);
-	return -1;
 }
 
 #define Next(x, m)	(((x)+1) & (m))
--- a/sys/src/9/pc/mmu.c
+++ b/sys/src/9/pc/mmu.c
@@ -831,7 +831,6 @@
 		}
 	}
 	panic("out of kmap");
-	return nil;
 }
 
 void
--- a/sys/src/9/pc/mp.c
+++ b/sys/src/9/pc/mp.c
@@ -169,7 +169,6 @@
 
 	if(apic == nil){
 		panic("mpinit: no bootstrap processor");
-		return;
 	}
 	apic->online = 1;
 
--- a/sys/src/9/pc/usbohci.c
+++ b/sys/src/9/pc/usbohci.c
@@ -1681,7 +1681,6 @@
 	default:
 		panic("epread: bad ep ttype %d", ep->ttype);
 	}
-	return -1;
 }
 
 /*
@@ -1913,7 +1912,6 @@
 	default:
 		panic("ohci: epwrite: bad ep ttype %d", ep->ttype);
 	}
-	return -1;
 }
 
 static Ed*
--- a/sys/src/9/pc/usbuhci.c
+++ b/sys/src/9/pc/usbuhci.c
@@ -1499,7 +1499,6 @@
 	default:
 		panic("epread: bad ep ttype %d", ep->ttype);
 	}
-	return -1;
 }
 
 /*
@@ -1636,7 +1635,6 @@
 	default:
 		panic("uhci: epwrite: bad ep ttype %d", ep->ttype);
 	}
-	return -1;
 }
 
 static void
--- a/sys/src/9/pc64/mmu.c
+++ b/sys/src/9/pc64/mmu.c
@@ -155,7 +155,6 @@
 	if(va >= VMAP)
 		return va-VMAP;
 	panic("paddr: va=%#p pc=%#p", va, getcallerpc(&v));
-	return 0;
 }
 
 static MMU*
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -1135,7 +1135,6 @@
 		}
 	}
 	error(Enocreate);
-	return 0;
 }
 
 void
@@ -1761,5 +1760,4 @@
 		poperror();
 	}
 	error(Eshortstat);
-	return nil;
 }
--- a/sys/src/9/port/dev.c
+++ b/sys/src/9/port/dev.c
@@ -443,7 +443,6 @@
 devcreate(Chan*, char*, int, ulong)
 {
 	error(Eperm);
-	return 0;
 }
 
 Block*
@@ -489,7 +488,6 @@
 devwstat(Chan*, uchar*, int)
 {
 	error(Eperm);
-	return 0;
 }
 
 void
@@ -502,5 +500,4 @@
 devconfig(int, char *, DevConf *)
 {
 	error(Eperm);
-	return 0;
 }
--- a/sys/src/9/port/devaoe.c
+++ b/sys/src/9/port/devaoe.c
@@ -814,7 +814,6 @@
 		}
 	runlock(&devs);
 	error("unit lookup failure");
-	return nil;
 }
 
 static int
--- a/sys/src/9/port/devcap.c
+++ b/sys/src/9/port/devcap.c
@@ -187,7 +187,6 @@
 		error(Eperm);
 		break;
 	}
-	return n;
 }
 
 static long
--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -220,7 +220,7 @@
 	return n;
 }
 
-void
+_Noreturn void
 panic(char *fmt, ...)
 {
 	int s;
@@ -617,7 +617,6 @@
 	
 	case Qmordor:
 		error("one does not simply read from mordor");
-		return 0;
 
 	case Qosversion:
 		snprint(tmp, sizeof tmp, "2000");
@@ -628,7 +627,6 @@
 		print("consread %#llux\n", c->qid.path);
 		error(Egreg);
 	}
-	return -1;		/* never reached */
 }
 
 static long
@@ -787,7 +785,6 @@
 	
 	case Qmordor:
 		error("one does not simply write into mordor");
-		return 0;
 
 	default:
 		print("conswrite: %#llux\n", c->qid.path);
--- a/sys/src/9/port/devdraw.c
+++ b/sys/src/9/port/devdraw.c
@@ -512,7 +512,6 @@
 		s = s->next;
 	}
 	error(Enodrawscreen);
-	return 0;
 }
 
 DImage*
--- a/sys/src/9/port/devdtracy.c
+++ b/sys/src/9/port/devdtracy.c
@@ -389,7 +389,6 @@
 		break;
 	default:
 		error(Egreg);
-		return 0;
 	}
 out:
 	qunlock(&dtracylock);
@@ -422,7 +421,6 @@
 	switch(FILE(c->qid)){
 	case Qdir:
 		error(Eperm);
-		return 0;
 	case Qctl:
 		cb = parsecmd(a, n);
 		if(waserror()){
@@ -458,7 +456,6 @@
 		}
 	default:
 		error(Egreg);
-		return 0;
 	}
 	qunlock(&dtracylock);
 	poperror();
--- a/sys/src/9/port/devdup.c
+++ b/sys/src/9/port/devdup.c
@@ -114,7 +114,6 @@
 		return readstr((ulong)offset, va, n, buf);
 	}
 	panic("dupread");
-	return 0;
 }
 
 static long
@@ -121,7 +120,6 @@
 dupwrite(Chan*, void*, long, vlong)
 {
 	error(Eperm);
-	return 0;		/* not reached */
 }
 
 Dev dupdevtab = {
--- a/sys/src/9/port/devether.c
+++ b/sys/src/9/port/devether.c
@@ -82,7 +82,6 @@
 ethercreate(Chan*, char*, int, ulong)
 {
 	error(Eperm);
-	return 0;
 }
 
 static void
--- a/sys/src/9/port/devflash.c
+++ b/sys/src/9/port/devflash.c
@@ -270,7 +270,6 @@
 		return n;
 	}
 	error(Egreg);
-	return 0;		/* not reached */
 }
 
 enum {
@@ -383,7 +382,6 @@
 		return n;
 	}
 	error(Egreg);
-	return 0;		/* not reached */
 }
 
 static char*
--- a/sys/src/9/port/devi2c.c
+++ b/sys/src/9/port/devi2c.c
@@ -506,7 +506,6 @@
 	switch(TYPE(c->qid)){
 	default:
 		error(Egreg);
-		return -1;
 	case Qctl:
 		dev = c->aux;
 		return i2cwrctl(dev, data, len);
--- a/sys/src/9/port/devmnt.c
+++ b/sys/src/9/port/devmnt.c
@@ -362,7 +362,6 @@
 noattach(char *)
 {
 	error(Enoattach);
-	return nil;
 }
 
 static Chan*
@@ -1281,7 +1280,6 @@
 		return i<<TAGSHIFT | j;
 	}
 	panic("no friggin tags left");
-	return NOTAG;
 }
 
 static void
--- a/sys/src/9/port/devmouse.c
+++ b/sys/src/9/port/devmouse.c
@@ -498,7 +498,6 @@
 	}
 
 	error(Egreg);
-	return -1;
 }
 
 Dev mousedevtab = {
--- a/sys/src/9/port/devpci.c
+++ b/sys/src/9/port/devpci.c
@@ -193,7 +193,6 @@
 	default:
 		error(Egreg);
 	}
-	return n;
 }
 
 static long
@@ -242,7 +241,6 @@
 	default:
 		error(Egreg);
 	}
-	return n;
 }
 
 Dev pcidevtab = {
--- a/sys/src/9/port/devpipe.c
+++ b/sys/src/9/port/devpipe.c
@@ -276,7 +276,6 @@
 	default:
 		panic("piperead");
 	}
-	return -1;	/* not reached */
 }
 
 static Block*
@@ -357,7 +356,6 @@
 		break;
 
 	default:
-		n = 0;
 		panic("pipebwrite");
 	}
 
--- a/sys/src/9/port/devroot.c
+++ b/sys/src/9/port/devroot.c
@@ -240,7 +240,6 @@
 rootwrite(Chan*, void*, long, vlong)
 {
 	error(Egreg);
-	return 0;
 }
 
 Dev rootdevtab = {
--- a/sys/src/9/port/devsd.c
+++ b/sys/src/9/port/devsd.c
@@ -1389,8 +1389,6 @@
 		 * "ata arg..." invokes sdifc[i]->wtopctl(nil, cb),
 		 * where sdifc[i]->name=="ata" and cb contains the args.
 		 */
-		ifc = nil;
-		sdev = nil;
 		for(i=0; sdifc[i] != nil; i++){
 			if(strcmp(sdifc[i]->name, f0) == 0){
 				ifc = sdifc[i];
--- a/sys/src/9/port/devsegment.c
+++ b/sys/src/9/port/devsegment.c
@@ -322,7 +322,6 @@
 	default:
 		panic("segmentread");
 	}
-	return 0;	/* not reached */
 }
 
 static long
@@ -387,7 +386,6 @@
 	default:
 		panic("segmentwrite");
 	}
-	return 0;	/* not reached */
 }
 
 static int
@@ -532,7 +530,6 @@
 	}
 	unlock(&palloc);
 	error(Enomem);
-	return nil;
 }
 
 Dev segmentdevtab = {
--- a/sys/src/9/port/devswap.c
+++ b/sys/src/9/port/devswap.c
@@ -554,7 +554,6 @@
 		return n;
 	}
 	error(Egreg);
-	return 0;
 }
 
 static long
@@ -587,7 +586,6 @@
 		return n;
 	}
 	error(Egreg);
-	return 0;
 }
 
 Dev swapdevtab = {
--- a/sys/src/9/port/devtls.c
+++ b/sys/src/9/port/devtls.c
@@ -1461,7 +1461,6 @@
 		if(strcmp(p, ha->name) == 0)
 			return ha;
 	error("unsupported hash algorithm");
-	return nil;
 }
 
 typedef struct Encalg Encalg;
@@ -1562,7 +1561,6 @@
 		if(strcmp(p, ea->name) == 0)
 			return ea;
 	error("unsupported encryption algorithm");
-	return nil;
 }
 
 static long
@@ -1613,7 +1611,6 @@
 		break;
 	default:
 		error(Ebadusefd);
-		return -1;
 	}
 
 	cb = parsecmd(a, n);
--- a/sys/src/9/port/devusb.c
+++ b/sys/src/9/port/devusb.c
@@ -876,7 +876,6 @@
 		break;
 	default:
 		error(Egreg);
-		return;
 	}
 
 	if(ep->ntds <= 0)
--- a/sys/src/9/port/ethersink.c
+++ b/sys/src/9/port/ethersink.c
@@ -29,7 +29,6 @@
 	}
 	free(cb);
 	error(Ebadctl);
-	return -1;	/* not reached */
 }
 
 static void
--- a/sys/src/9/port/fault.c
+++ b/sys/src/9/port/fault.c
@@ -160,7 +160,6 @@
 	switch(s->type & SG_TYPE) {
 	default:
 		panic("fault");
-		return -1;
 
 	case SG_TEXT: 			/* Demand load */
 		if(pagedout(*pg))
--- a/sys/src/9/port/netif.c
+++ b/sys/src/9/port/netif.c
@@ -247,7 +247,6 @@
 		return 0;
 	}
 	error(Ebadarg);
-	return -1;	/* not reached */
 }
 
 Block*
@@ -548,7 +547,6 @@
 		return fp - nif->f;
 	}
 	error(Enodev);
-	return -1;	/* not reached */
 }
 
 /*
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -101,7 +101,7 @@
 int		eqchan(Chan*, Chan*, int);
 int		eqchantdqid(Chan*, int, int, Qid, int);
 int		eqqid(Qid, Qid);
-void		error(char*);
+_Noreturn void	error(char*);
 void		eqlock(QLock*);
 uintptr		execregs(uintptr, ulong, ulong);
 void		exhausted(char*);
@@ -128,7 +128,7 @@
 void		getcolor(ulong, ulong*, ulong*, ulong*);
 uintptr		getmalloctag(void*);
 uintptr		getrealloctag(void*);
-void		gotolabel(Label*);
+_Noreturn void	gotolabel(Label*);
 char*		getconfenv(void);
 long		hostdomainwrite(char*, int);
 long		hostownerwrite(char*, int);
@@ -217,7 +217,7 @@
 Pgrp*		newpgrp(void);
 Rgrp*		newrgrp(void);
 Proc*		newproc(void);
-void		nexterror(void);
+_Noreturn void	nexterror(void);
 int		notify(Ureg*);
 ulong		nkpages(Confmem*);
 uvlong		ns2fastticks(uvlong);
@@ -227,11 +227,11 @@
 Block*		padblock(Block*, int);
 void		pageinit(void);
 ulong		pagereclaim(Image*);
-void		panic(char*, ...);
+_Noreturn void	panic(char*, ...);
 Cmdbuf*		parsecmd(char *a, int n);
 void		pathclose(Path*);
 ulong		perfticks(void);
-void		pexit(char*, int);
+_Noreturn void	pexit(char*, int);
 void		pgrpcpy(Pgrp*, Pgrp*);
 ulong		pidalloc(Proc*);
 #define		waserror()		setlabel(&up->errlab[up->nerrlab++])
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -1232,7 +1232,7 @@
 	}
 }
 
-void
+_Noreturn void
 pexit(char *exitstr, int freemem)
 {
 	Proc *p;
@@ -1673,7 +1673,7 @@
 
 #include "errstr.h"
 
-void
+_Noreturn void
 error(char *err)
 {
 	spllo();
@@ -1684,7 +1684,7 @@
 	nexterror();
 }
 
-void
+_Noreturn void
 nexterror(void)
 {
 	assert(up->nerrlab > 0);
--- a/sys/src/9/port/sdscsi.c
+++ b/sys/src/9/port/sdscsi.c
@@ -426,7 +426,6 @@
 		case 0x01:		/* recovered error */
 			print("%s: recovered error at sector %llud\n",
 				unit->name, bno);
-			rlen = r->rlen;
 			break;
 		case 0x06:		/* check condition */
 			/*
--- a/sys/src/9/port/sysfile.c
+++ b/sys/src/9/port/sysfile.c
@@ -143,7 +143,6 @@
 	Chan *c;
 	Fgrp *f;
 
-	c = nil;
 	f = up->fgrp;
 
 	lock(f);
@@ -847,7 +846,6 @@
 	if(devtab[c->type]->dc == L'|')
 		error(Eisstream);
 
-	off = 0;
 	switch(type){
 	case 0:
 		off = o;
@@ -1393,7 +1391,6 @@
 sys_wstat(va_list)
 {
 	error("old wstat system call - recompile");
-	return (uintptr)-1;
 }
 
 uintptr
@@ -1400,5 +1397,4 @@
 sys_fwstat(va_list)
 {
 	error("old fwstat system call - recompile");
-	return (uintptr)-1;
 }
--- a/sys/src/9/port/sysproc.c
+++ b/sys/src/9/port/sysproc.c
@@ -680,7 +680,6 @@
 
 	}
 	pexit(status, 1);
-	return 0;	/* not reached */
 }
 
 uintptr
@@ -822,7 +821,6 @@
 		}
 	}
 	error(Ebadarg);
-	return 0;	/* not reached */
 }
 
 uintptr
@@ -864,7 +862,6 @@
 		nexterror();
 	}
 
-	s = nil;
 	for(i = 0; i < NSEG; i++)
 		if((s = up->seg[i]) != nil) {
 			qlock(s);
--- a/sys/src/9/port/wifi.c
+++ b/sys/src/9/port/wifi.c
@@ -922,7 +922,6 @@
 		break;
 	default:
 		error(Ebadkey);
-		return nil;
 	}
 
 	memset(key, 0, sizeof(key));
--- a/sys/src/9/sgi/devkbd.c
+++ b/sys/src/9/sgi/devkbd.c
@@ -233,7 +233,6 @@
 		return devdirread(c, a, n, kbdtab, nelem(kbdtab), devgen);
 
 	error(Egreg);
-	return 0;
 }
 
 static long
--- a/sys/src/9/teg2/archtegra.c
+++ b/sys/src/9/teg2/archtegra.c
@@ -850,18 +850,9 @@
  * return -1 on error (no flash)
  */
 int
-archflashreset(int bank, Flash *f)
+archflashreset(int bank, Flash *)
 {
 	if(bank != 0)
 		return -1;
-panic("archflashreset: rewrite for nor & nand flash on ts");
-	/*
-	 * this is set up for the igepv2 board.
-	 */
-	f->type = "onenand";
-	f->addr = (void*)VIRTNOR;		/* mapped here by archreset */
-	f->size = 0;				/* done by probe */
-	f->width = 1;
-	f->interleave = 0;
-	return 0;
+	panic("archflashreset: rewrite for nor & nand flash on ts");
 }
--- a/sys/src/9/teg2/devarch.c
+++ b/sys/src/9/teg2/devarch.c
@@ -110,8 +110,6 @@
 		error(Eperm);
 		break;
 	}
-
-	return 0;
 }
 
 static long
@@ -122,8 +120,6 @@
 	if(c->qid.path < narchdir && (fn = writefn[c->qid.path]))
 		return fn(c, a, n, offset);
 	error(Eperm);
-
-	return 0;
 }
 
 void archinit(void);
--- a/sys/src/9/teg2/trap.c
+++ b/sys/src/9/teg2/trap.c
@@ -804,8 +804,8 @@
 void
 trap(Ureg *ureg)
 {
-	int user, rem;
 	uintptr va, ifar, ifsr;
+	int user;
 
 	user = kenter(ureg);
 	/*
--- a/sys/src/9/xen/devrtc.c
+++ b/sys/src/9/xen/devrtc.c
@@ -30,7 +30,6 @@
 		return readnum((ulong)offset, a, n, xenwallclock(), 12);
 	}
 	error(Ebadarg);
-	return 0;
 }
 
 static long
@@ -41,7 +40,6 @@
 		return n;
 	}
 	error(Eperm);
-	return 0;
 }
 
 static Chan*
--- a/sys/src/9/xen/etherxen.c
+++ b/sys/src/9/xen/etherxen.c
@@ -332,7 +332,6 @@
 	}
 	free(cb);
 	error(Ebadctl);
-	return -1;	/* not reached */
 }
 
 static void
--- a/sys/src/9/xen/trap.c
+++ b/sys/src/9/xen/trap.c
@@ -335,7 +335,6 @@
 		//dumpregs(ureg);
 		dumpstack();
 		panic("fault386");
-		exit(1);
 	}
 	
 	user = (ureg->cs & 0xFFFF) == UESEL;
--- a/sys/src/9/xen/uartxen.c
+++ b/sys/src/9/xen/uartxen.c
@@ -77,7 +77,7 @@
  * Handle channel event from console
  */
 static void
-interrupt(Ureg*, void *arg)
+interrupt(Ureg*, void*)
 {
 	char c;
 	unsigned long cons;
--- a/sys/src/9/zynq/devarch.c
+++ b/sys/src/9/zynq/devarch.c
@@ -304,7 +304,6 @@
 		return fbctlread(c, a, n, offset);
 	default:
 		error(Egreg);
-		return -1;
 	}
 }
 
@@ -318,7 +317,6 @@
 		return fbctlwrite(c, a, n, offset);
 	default:
 		error(Egreg);
-		return -1;
 	}
 }
 
--- a/sys/src/9/zynq/devqspi.c
+++ b/sys/src/9/zynq/devqspi.c
@@ -227,7 +227,6 @@
 		return doread(offset, a, n);
 	default:
 		error(Egreg);
-		return -1;
 	}
 }
 
@@ -239,7 +238,6 @@
 		return dowrite(offset, a, n);
 	default:
 		error(Egreg);
-		return -1;
 	}
 }
 
--- a/sys/src/9/zynq/mmu.c
+++ b/sys/src/9/zynq/mmu.c
@@ -240,7 +240,6 @@
 	if((uintptr)v >= VMAP)
 		return ((uintptr)v & (BY2PG-1)) | PPN(((ulong*)VMAPL2)[(uintptr)v-VMAP >> PGSHIFT]);
 	panic("paddr: va=%#p pc=%#p", v, getcallerpc(&v));
-	return 0;
 }
 
 void *
@@ -251,7 +250,6 @@
 	if(u >= OCM_BASE)
 		return (void *)(ocm + (u - OCM_BASE));
 	panic("kaddr: pa=%#p pc=%#p", u, getcallerpc(&u));
-	return nil;
 }
 
 uintptr
@@ -305,7 +303,6 @@
 			return (KMap *) (KMAP + i * BY2PG);
 		}
 	panic("out of kmap");
-	return nil;
 }
 
 void
@@ -355,7 +352,6 @@
 			return (void *) ((u - ub) * BY2PG + TMAP);
 		}
 	panic("tmpmap: full (pa=%#.8lux)", pa);
-	return nil;
 }
 
 void