aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorYoshihiro Takahashi <nyan@FreeBSD.org>2002-10-07 13:05:45 +0000
committerYoshihiro Takahashi <nyan@FreeBSD.org>2002-10-07 13:05:45 +0000
commit88b2247e41c42ba63c7bca16ba05ca301bbdde39 (patch)
treebd33017fd0311dfe162bad6ca1654c42b2c3cfe9 /sys
parente74334caae7fd92794efd928a8cb748ca912b029 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/pc98/cbus/fdc.c14
-rw-r--r--sys/pc98/pc98/fd.c14
2 files changed, 22 insertions, 6 deletions
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c
index b088ee3f7f96d..d497e11dd3c61 100644
--- a/sys/pc98/cbus/fdc.c
+++ b/sys/pc98/cbus/fdc.c
@@ -1289,8 +1289,10 @@ fdc_add_child(device_t dev, const char *name, int unit)
if (resource_int_value(name, unit, "drive", &ivar->fdunit) != 0)
ivar->fdunit = 0;
child = device_add_child(dev, name, unit);
- if (child == NULL)
+ if (child == NULL) {
+ free(ivar, M_DEVBUF);
return;
+ }
device_set_ivars(child, ivar);
if (resource_int_value(name, unit, "flags", &flags) == 0)
device_set_flags(child, flags);
@@ -1546,7 +1548,13 @@ fd_probe(device_t dev)
#endif /* EPSON_NRDISK */
}
#else /* PC98 */
-#if _MACHINE_ARCH == i386
+/*
+ * XXX I think using __i386__ is wrong here since we actually want to probe
+ * for the machine type, not the CPU type (so non-PC arch's like the PC98 will
+ * fail the probe). However, for whatever reason, testing for _MACHINE_ARCH
+ * == i386 breaks the test on FreeBSD/Alpha.
+ */
+#ifdef __i386__
if (fd->type == FDT_NONE && (fd->fdu == 0 || fd->fdu == 1)) {
/* Look up what the BIOS thinks we have. */
if (fd->fdu == 0) {
@@ -1566,7 +1574,7 @@ fd_probe(device_t dev)
if (fd->type == FDT_288M_1)
fd->type = FDT_288M;
}
-#endif /* _MACHINE_ARCH == i386 */
+#endif /* __i386__ */
#endif /* PC98 */
/* is there a unit? */
diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c
index b088ee3f7f96d..d497e11dd3c61 100644
--- a/sys/pc98/pc98/fd.c
+++ b/sys/pc98/pc98/fd.c
@@ -1289,8 +1289,10 @@ fdc_add_child(device_t dev, const char *name, int unit)
if (resource_int_value(name, unit, "drive", &ivar->fdunit) != 0)
ivar->fdunit = 0;
child = device_add_child(dev, name, unit);
- if (child == NULL)
+ if (child == NULL) {
+ free(ivar, M_DEVBUF);
return;
+ }
device_set_ivars(child, ivar);
if (resource_int_value(name, unit, "flags", &flags) == 0)
device_set_flags(child, flags);
@@ -1546,7 +1548,13 @@ fd_probe(device_t dev)
#endif /* EPSON_NRDISK */
}
#else /* PC98 */
-#if _MACHINE_ARCH == i386
+/*
+ * XXX I think using __i386__ is wrong here since we actually want to probe
+ * for the machine type, not the CPU type (so non-PC arch's like the PC98 will
+ * fail the probe). However, for whatever reason, testing for _MACHINE_ARCH
+ * == i386 breaks the test on FreeBSD/Alpha.
+ */
+#ifdef __i386__
if (fd->type == FDT_NONE && (fd->fdu == 0 || fd->fdu == 1)) {
/* Look up what the BIOS thinks we have. */
if (fd->fdu == 0) {
@@ -1566,7 +1574,7 @@ fd_probe(device_t dev)
if (fd->type == FDT_288M_1)
fd->type = FDT_288M;
}
-#endif /* _MACHINE_ARCH == i386 */
+#endif /* __i386__ */
#endif /* PC98 */
/* is there a unit? */