diff options
Diffstat (limited to 'libdde_linux26/lib/src/mach_glue/block.c')
-rw-r--r-- | libdde_linux26/lib/src/mach_glue/block.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libdde_linux26/lib/src/mach_glue/block.c b/libdde_linux26/lib/src/mach_glue/block.c index 7eac7e46..a856cc9b 100644 --- a/libdde_linux26/lib/src/mach_glue/block.c +++ b/libdde_linux26/lib/src/mach_glue/block.c @@ -9,8 +9,12 @@ void dde_page_cache_add (struct page *); struct block_device *open_block_dev (char *name, int part, fmode_t mode) { struct gendisk *disk = find_disk_by_name (name); - dev_t devid = MKDEV (disk->major, disk->first_minor + part); - return open_by_devnum (devid, mode); + if (disk) + { + dev_t devid = MKDEV (disk->major, disk->first_minor + part); + return open_by_devnum (devid, mode); + } + return ERR_PTR(-ENXIO); } /* write a piece of data to a block device. |