Hello,
Function rdioctl() uses a goto to leave the switch statement
but a break would be enough. There is no other code to jump over
(avoid) as with rdstrategy() which has goto bad and goto done.
- Michael
Index: rd.c
===================================================================
RCS file: /cvs/src/sys/dev/rd.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 rd.c
--- rd.c 30 Dec 2017 23:08:29 -0000 1.13
+++ rd.c 29 Jan 2018 03:52:56 -0000
@@ -266,31 +266,31 @@ rdioctl(dev_t dev, u_long cmd, caddr_t d
rdgetdisklabel(dev, sc, lp, 0);
memcpy(sc->sc_dk.dk_label, lp, sizeof(*lp));
free(lp, M_TEMP, sizeof(*lp));
- goto done;
+ break;
case DIOCGPDINFO:
rdgetdisklabel(dev, sc, (struct disklabel *)data, 1);
- goto done;
+ break;
case DIOCGDINFO:
*(struct disklabel *)data = *(sc->sc_dk.dk_label);
- goto done;
+ break;
case DIOCGPART:
((struct partinfo *)data)->disklab = sc->sc_dk.dk_label;
((struct partinfo *)data)->part =
&sc->sc_dk.dk_label->d_partitions[DISKPART(dev)];
- goto done;
+ break;
case DIOCWDINFO:
case DIOCSDINFO:
if ((fflag & FWRITE) == 0) {
error = EBADF;
- goto done;
+ break;
}
if ((error = disk_lock(&sc->sc_dk)) != 0)
- goto done;
+ break;
error = setdisklabel(sc->sc_dk.dk_label,
(struct disklabel *)data, sc->sc_dk.dk_openmask);
@@ -301,10 +301,9 @@ rdioctl(dev_t dev, u_long cmd, caddr_t d
}
disk_unlock(&sc->sc_dk);
- goto done;
+ break;
}
- done:
device_unref(&sc->sc_dev);
return (error);
}