From 812703123414d84daa2241bf86350c655290e916 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Sat, 21 Jul 2018 06:35:01 -0700 Subject: [PATCH] staging: gasket: apex return error on sysfs show of missing attribute Apex sysfs show function return -ENODEV if the attribute is not present, rather than silently failing from the standpoint of the userspace accessor. Reported-by: Guenter Roeck Signed-off-by: Todd Poynor Signed-off-by: Greg Kroah-Hartman --- apex_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apex_driver.c b/apex_driver.c index c95071e..3d74611 100644 --- a/apex_driver.c +++ b/apex_driver.c @@ -780,14 +780,14 @@ static ssize_t sysfs_show( gasket_dev = gasket_sysfs_get_device_data(device); if (!gasket_dev) { gasket_nodev_error("No Apex device sysfs mapping found"); - return 0; + return -ENODEV; } gasket_attr = gasket_sysfs_get_attr(device, attr); if (!gasket_attr) { gasket_nodev_error("No Apex device sysfs attr data found"); gasket_sysfs_put_device_data(device, gasket_dev); - return 0; + return -ENODEV; } type = (enum sysfs_attribute_type)gasket_sysfs_get_attr(device, attr);