diff options
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r-- | fs/fat/fat.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 15879c4160..e65ef585a2 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -373,19 +373,15 @@ static int fat_probe(struct device_d *dev) { struct fs_device_d *fsdev = dev_to_fs_device(dev); struct fat_priv *priv = xzalloc(sizeof(struct fat_priv)); - char *backingstore = fsdev->backingstore; int ret; dev->priv = priv; - if (!strncmp(backingstore , "/dev/", 5)) - backingstore += 5; - - priv->cdev = cdev_open(backingstore, O_RDWR); - if (!priv->cdev) { - ret = -ENOENT; + ret = fsdev_open_cdev(fsdev); + if (ret) goto err_open; - } + + priv->cdev = fsdev->cdev; priv->fat.userdata = priv; ret = f_mount(&priv->fat); @@ -395,7 +391,6 @@ static int fat_probe(struct device_d *dev) return 0; err_mount: - cdev_close(priv->cdev); err_open: free(priv); @@ -404,10 +399,6 @@ err_open: static void fat_remove(struct device_d *dev) { - struct fat_priv *priv = dev->priv; - - cdev_close(priv->cdev); - free(dev->priv); } |