]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
PCI: return correct value when writing to the "reset" attribute
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 11 May 2010 09:44:54 +0000 (11:44 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 27 Mar 2011 18:30:32 +0000 (11:30 -0700)
commit 447c5dd7338638f526e9bcf7dcf69b4da5835c7d upstream.

A successful write() to the "reset" sysfs attribute should return the
number of bytes written, not 0. Otherwise userspace (bash) retries the
write over and over again.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/pci-sysfs.c

index 0964b4c7e4c1999a2876ef7b6c87c5b22632a246..8313311bd3a74e655029a99bcf628a11f2e28520 100644 (file)
@@ -939,7 +939,12 @@ static ssize_t reset_store(struct device *dev,
 
        if (val != 1)
                return -EINVAL;
-       return pci_reset_function(pdev);
+
+       result = pci_reset_function(pdev);
+       if (result < 0)
+               return result;
+
+       return count;
 }
 
 static struct device_attribute reset_attr = __ATTR(reset, 0200, NULL, reset_store);