greybus: loopback: Fix broken loopback min values

Currently, when a loopback test completely fail,
loopback will return 4294967295 for every min value.
Return 0 instead of 4294967295 in such case.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Alexandre Bailon 2016-03-11 17:23:37 +01:00 committed by Greg Kroah-Hartman
parent d18da86b51
commit 1dc8d3d7c5
1 changed files with 3 additions and 0 deletions

View File

@ -148,6 +148,9 @@ static ssize_t name##_##field##_show(struct device *dev, \
char *buf) \ char *buf) \
{ \ { \
struct gb_loopback *gb = dev_get_drvdata(dev); \ struct gb_loopback *gb = dev_get_drvdata(dev); \
/* Report 0 for min and max if no transfer successed */ \
if (!gb->requests_completed) \
return sprintf(buf, "0\n"); \
return sprintf(buf, "%"#type"\n", gb->name.field); \ return sprintf(buf, "%"#type"\n", gb->name.field); \
} \ } \
static DEVICE_ATTR_RO(name##_##field) static DEVICE_ATTR_RO(name##_##field)