commit 0e1d436f122e363f9d290e5548bd3f453a451cba
parent e0d5ba6eda6df2067732547281d07de3f896a541
Author: Roberto Vargas <roberto.vargas@arm.com>
Date: Tue, 11 Dec 2018 16:21:38 +0000
[drivers] Remove warnings
Change-Id: I36339283b5b792ef7f87463ee5beeb51c6e728c1
Diffstat:
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/dev.c b/drivers/dev.c
@@ -227,9 +227,10 @@ devwalk(Chan *c, const char *name, const Dirtab *tab, int ntab, Devgen *gen)
int
devdirread(Chan *c, char *buf, int nbytes, const Dirtab *tab, int ntab, Devgen *gen)
{
- int n, cnt, i;
+ int cnt, i;
Dir dir;
+ cnt = 0;
for (i = c->offset/DIRLEN; nbytes >= DIRLEN; i++) {
switch ((*gen)(c, tab, ntab, i, &dir)) {
case -1:
@@ -239,12 +240,9 @@ devdirread(Chan *c, char *buf, int nbytes, const Dirtab *tab, int ntab, Devgen *
break;
case 1:
memcpy(buf + cnt, &dir, DIRLEN);
- /*
- * TODO: n is not initialized here. We still have to
- * consider using 9p
- */
- nbytes -= n;
- cnt += n;
+ /* TODO: We still have to consider using 9p */
+ nbytes -= 1;
+ cnt += 1;
}
}
@@ -363,7 +361,6 @@ idev(void)
{
struct devdata *dinfo;
Chan *c, *lim;
- int i;
dinfo = alloc(sizeof(*dinfo));
bss->devinfo = dinfo;