staging: gasket: apex return error on sysfs show of missing attribute
authorTodd Poynor <toddpoynor@google.com>
Sat, 21 Jul 2018 13:35:01 +0000 (06:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jul 2018 11:56:46 +0000 (13:56 +0200)
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 <groeck@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gasket/apex_driver.c

index 3e76c4db5db2e319607c318ceec57963c62a5be7..1c6f73b5a2a9e25c086cb9b36472b6380c03a796 100644 (file)
@@ -710,14 +710,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);