shithub: riscv

Download patch

ref: dc725301592117ad0e70a0ab21926dcf5302ed31
parent: 1290c534bef72b282b4c562b95a4b2be8237e3b0
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Feb 4 20:25:28 EST 2022

devgpio: make reading ctl file return 0 bytes

--- a/sys/src/9/bcm/devgpio.c
+++ b/sys/src/9/bcm/devgpio.c
@@ -448,6 +448,7 @@
 		n = 1;
 		break;
 	case Qctl:
+		n = 0;
 		break;
 	case Qevent:
 		if(off >= 4)
@@ -555,10 +556,10 @@
 			break;
 		case CMfunc:
 			pin = getpin(cb->f[2]);
-			arg = cb->f[1];
 			if(pin == -1) {
 				error(Ebadctl);
 			}
+			arg = cb->f[1];
 			for(i = 0; i < nelem(funcname); i++)
 			{
 				if(strncmp(funcname[i], arg, strlen(funcname[i])) == 0)
@@ -588,7 +589,6 @@
 			if(pin == -1) {
 				error(Ebadctl);
 			}
-				
 			arg = cb->f[1];
 			for(i = 0; i < nelem(evtypename); i++)
 			{