tree-wide: drop assignments to r when we only need errno
If the whole call is simple and we don't need to look at the return value apart from the conditional, let's use a form without assignment of the return value. When the function call is more complicated, it still makes sense to use a temporary variable.
This commit is contained in:
@@ -110,10 +110,8 @@ static const char* parse_token(const char *current, int32_t *val_out) {
|
||||
static int override_abs(sd_device *dev, int fd, unsigned evcode, const char *value) {
|
||||
struct input_absinfo absinfo;
|
||||
const char *next;
|
||||
int r;
|
||||
|
||||
r = ioctl(fd, EVIOCGABS(evcode), &absinfo);
|
||||
if (r < 0)
|
||||
if (ioctl(fd, EVIOCGABS(evcode), &absinfo) < 0)
|
||||
return log_device_error_errno(dev, errno, "Failed to call EVIOCGABS");
|
||||
|
||||
next = parse_token(value, &absinfo.minimum);
|
||||
@@ -122,12 +120,12 @@ static int override_abs(sd_device *dev, int fd, unsigned evcode, const char *val
|
||||
next = parse_token(next, &absinfo.fuzz);
|
||||
next = parse_token(next, &absinfo.flat);
|
||||
if (!next)
|
||||
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Failed to parse EV_ABS override '%s'", value);
|
||||
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to parse EV_ABS override '%s'", value);
|
||||
|
||||
log_device_debug(dev, "keyboard: %x overridden with %"PRIi32"/%"PRIi32"/%"PRIi32"/%"PRIi32"/%"PRIi32,
|
||||
evcode, absinfo.minimum, absinfo.maximum, absinfo.resolution, absinfo.fuzz, absinfo.flat);
|
||||
r = ioctl(fd, EVIOCSABS(evcode), &absinfo);
|
||||
if (r < 0)
|
||||
if (ioctl(fd, EVIOCSABS(evcode), &absinfo) < 0)
|
||||
return log_device_error_errno(dev, errno, "Failed to call EVIOCSABS");
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user