Drop extra checks and explicit indirect call in devfs_erase() in
favour of using cdev_erase(), since it already does all of the above.

Signed-off-by: Andrey Smirnov <andrew.smir...@gmail.com>
---
 fs/devfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/devfs.c b/fs/devfs.c
index a7400df1c..ce04d0243 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -78,13 +78,10 @@ static int devfs_erase(struct device_d *_dev, FILE *f, 
loff_t count, loff_t offs
        if (cdev->flags & DEVFS_PARTITION_READONLY)
                return -EPERM;
 
-       if (!cdev->ops->erase)
-               return -ENOSYS;
-
        if (count + offset > cdev->size)
                count = cdev->size - offset;
 
-       return cdev->ops->erase(cdev, count, offset + cdev->offset);
+       return cdev_erase(cdev, count, offset);
 }
 
 static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t 
offset, int prot)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to