Currently, /dev/null discards all writes, but returns -ENOSYS on read.
Implement read to return 0 always, so it returns EOF immediately.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 commands/stddev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/commands/stddev.c b/commands/stddev.c
index e9b7dcc0d2f3..16cf4e30802d 100644
--- a/commands/stddev.c
+++ b/commands/stddev.c
@@ -64,8 +64,14 @@ static ssize_t null_write(struct cdev *cdev, const void 
*buf, size_t count, loff
        return count;
 }
 
+static ssize_t null_read(struct cdev *cdev, void *buf, size_t count, loff_t 
offset, ulong flags)
+{
+       return 0;
+}
+
 static struct cdev_operations nullops = {
        .write = null_write,
+       .read = null_read,
 };
 
 static int null_init(void)
-- 
2.39.5


Reply via email to