Skip to content

Commit

Permalink
PCI: return correct value when writing to the "reset" attribute
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Michal Schmidt <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
  • Loading branch information
michich authored and jbarnes993 committed May 11, 2010
1 parent 3196180 commit 447c5dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,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);
Expand Down

0 comments on commit 447c5dd

Please sign in to comment.