summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/hibernate_machdep.c9
-rw-r--r--sys/arch/i386/i386/hibernate_machdep.c8
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c
index 923576d7ebd..c793aca1287 100644
--- a/sys/arch/amd64/amd64/hibernate_machdep.c
+++ b/sys/arch/amd64/amd64/hibernate_machdep.c
@@ -71,13 +71,18 @@ extern struct hibernate_state *hibernate_state;
hibio_fn
get_hibernate_io_function(void)
{
+ char *blkname = findblkname(major(swdevt[0].sw_dev));
+
+ if (blkname == NULL)
+ return NULL;
+
#if NWD > 0
/* XXX - Only support wd hibernate presently */
- if (strcmp(findblkname(major(swdevt[0].sw_dev)), "wd") == 0)
+ if (strcmp(blkname, "wd") == 0)
return wd_hibernate_io;
#endif
#if NAHCI > 0 && NSD > 0
- if (strcmp(findblkname(major(swdevt[0].sw_dev)), "sd") == 0) {
+ if (strcmp(blkname, "sd") == 0) {
extern struct cfdriver sd_cd;
extern int ahci_hibernate_io(dev_t dev, daddr_t blkno,
vaddr_t addr, size_t size, int op, void *page);
diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c
index 5df2656cd20..699dd615e85 100644
--- a/sys/arch/i386/i386/hibernate_machdep.c
+++ b/sys/arch/i386/i386/hibernate_machdep.c
@@ -70,13 +70,17 @@ extern struct hibernate_state *hibernate_state;
hibio_fn
get_hibernate_io_function(void)
{
+ char *blkname = findblkname(major(swdevt[0].sw_dev));
+
+ if (blkname == NULL)
+ return NULL;
#if NWD > 0
/* XXX - Only support wd hibernate presently */
- if (strcmp(findblkname(major(swdevt[0].sw_dev)), "wd") == 0)
+ if (strcmp(blkname, "wd") == 0)
return wd_hibernate_io;
#endif
#if NAHCI > 0 && NSD > 0
- if (strcmp(findblkname(major(swdevt[0].sw_dev)), "sd") == 0) {
+ if (strcmp(blkname, "sd") == 0) {
extern struct cfdriver sd_cd;
extern int ahci_hibernate_io(dev_t dev, daddr_t blkno,
vaddr_t addr, size_t size, int op, void *page);