1
0
forked from drath/libratbag

Fix the various scan-build warnings for dead assignments

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-07-10 15:21:15 +10:00
committed by Benjamin Tissoires
parent df2a06690d
commit 37c8dec45c
6 changed files with 15 additions and 10 deletions

View File

@@ -652,6 +652,9 @@ etekcity_probe(struct ratbag_device *device)
rc = ratbag_hidraw_raw_request(device, ETEKCITY_REPORT_ID_SPEED_SETTING,
drv_data->speed_setting, ETEKCITY_REPORT_SIZE_SPEED_SETTING,
HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
if (rc)
return rc;
log_debug(device->ratbag, "device is at %d ms of latency\n", drv_data->speed_setting[2]);
/* profiles are 0-indexed */

View File

@@ -772,6 +772,8 @@ hidpp20drv_init_feature(struct ratbag_device *device, uint16_t feature)
&feature_index,
&feature_type,
&feature_version);
if (rc < 0)
return rc;
switch (feature) {
case HIDPP_PAGE_ROOT:

View File

@@ -1080,7 +1080,6 @@ hidpp10_onboard_profiles_macro_next(struct hidpp10_device *device,
break;
case HIDPP10_MACRO_END:
step = 1;
return 0;
default:
if (macro->any.type >= 0x80 && macro->any.type <= 0xFE) {

View File

@@ -975,7 +975,6 @@ int hidpp20_adjustable_dpi_get_sensors(struct hidpp20_device *device,
*sensors_list = s_list;
return num_sensors;
err:
num_sensors = 0;
free(s_list);
return rc > 0 ? -EPROTO : rc;
}
@@ -1457,7 +1456,6 @@ hidpp20_onboard_profiles_macro_next(struct hidpp20_device *device,
rc = -EAGAIN;
break;
case HIDPP20_MACRO_END:
step = 1;
return 0;
default:
hidpp_log_error(&device->base, "unknown tag: 0x%02x\n", macro->any.type);

View File

@@ -488,7 +488,7 @@ START_TEST(device_freed_before_profile)
is_active = ratbag_profile_is_active(p);
ck_assert_int_eq(is_active, 1);
p = ratbag_profile_unref(p);
ratbag_profile_unref(p);
ratbag_unref(r);
ck_assert_int_eq(device_freed_count, 1);
}

View File

@@ -480,13 +480,13 @@ ratbag_cmd_info(const struct ratbag_cmd *cmd,
printf(" Button: %d type %s is mapped to '%s'\n",
b, button_type_to_str(type), action);
free(action);
button = ratbag_button_unref(button);
ratbag_button_unref(button);
}
for (l = 0; l < num_leds; l++) {
led = ratbag_profile_get_led(profile, l);
ratbag_printf_led(led, " LED: %d ", l);
led = ratbag_led_unref(led);
ratbag_led_unref(led);
}
ratbag_profile_unref(profile);
@@ -540,8 +540,8 @@ ratbag_cmd_switch_etekcity(const struct ratbag_cmd *cmd,
commit = 2;
}
button_6 = ratbag_button_unref(button_6);
button_7 = ratbag_button_unref(button_7);
ratbag_button_unref(button_6);
ratbag_button_unref(button_7);
printf("Switched the current profile of '%s' to %sreport the volume keys\n",
ratbag_device_get_name(device),
@@ -673,6 +673,9 @@ ratbag_cmd_change_button(const struct ratbag_cmd *cmd,
argc -= 3;
argv += 3;
(void)argc;
(void)argv;
if (streq(action_str, "button")) {
action_type = RATBAG_BUTTON_ACTION_TYPE_BUTTON;
btnkey = atoi(action_arg);
@@ -766,7 +769,7 @@ ratbag_cmd_change_button(const struct ratbag_cmd *cmd,
}
out:
button = ratbag_button_unref(button);
ratbag_button_unref(button);
return rc;
}
@@ -1869,7 +1872,7 @@ ratbag_cmd_profile_active_set(const struct ratbag_cmd *cmd,
}
out:
profile = ratbag_profile_unref(profile);
ratbag_profile_unref(profile);
return rc;
}