Skip to content

Commit

Permalink
HID: logitech: Prevent possibility of infinite loop when using /sys i…
Browse files Browse the repository at this point in the history
…nterface

If the device data is not accessible for some reason, returning 0 will cause the call to be
continuously called again as none of the string has been 'consumed'.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Simon Wood authored and Jiri Kosina committed Aug 15, 2014
1 parent daebdd7 commit 29ff665
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hid/hid-lg4ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,13 @@ static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *at
drv_data = hid_get_drvdata(hid);
if (!drv_data) {
hid_err(hid, "Private driver data not found!\n");
return 0;
return -EINVAL;
}

entry = drv_data->device_props;
if (!entry) {
hid_err(hid, "Device properties not found!\n");
return 0;
return -EINVAL;
}

if (range == 0)
Expand Down

0 comments on commit 29ff665

Please sign in to comment.