tree-wide: do not assign unused return values

This commit is contained in:
Yu Watanabe 2018-09-01 23:12:47 +09:00
parent 8a80712bcd
commit 2c740afd16
3 changed files with 13 additions and 25 deletions

View file

@ -271,7 +271,6 @@ static int parse_options(const char *options) {
} }
static char* disk_description(const char *path) { static char* disk_description(const char *path) {
static const char name_fields[] = static const char name_fields[] =
"ID_PART_ENTRY_NAME\0" "ID_PART_ENTRY_NAME\0"
"DM_NAME\0" "DM_NAME\0"
@ -279,9 +278,8 @@ static char* disk_description(const char *path) {
"ID_MODEL\0"; "ID_MODEL\0";
_cleanup_(sd_device_unrefp) sd_device *device = NULL; _cleanup_(sd_device_unrefp) sd_device *device = NULL;
const char *i, *name;
struct stat st; struct stat st;
const char *i;
int r;
assert(path); assert(path);
@ -291,17 +289,13 @@ static char* disk_description(const char *path) {
if (!S_ISBLK(st.st_mode)) if (!S_ISBLK(st.st_mode))
return NULL; return NULL;
r = sd_device_new_from_devnum(&device, 'b', st.st_rdev); if (sd_device_new_from_devnum(&device, 'b', st.st_rdev) < 0)
if (r < 0)
return NULL; return NULL;
NULSTR_FOREACH(i, name_fields) { NULSTR_FOREACH(i, name_fields)
const char *name; if (sd_device_get_property_value(device, i, &name) >= 0 &&
!isempty(name))
r = sd_device_get_property_value(device, i, &name);
if (r >= 0 && !isempty(name))
return strdup(name); return strdup(name);
}
return NULL; return NULL;
} }

View file

@ -357,8 +357,7 @@ int main(int argc, char *argv[]) {
root_directory = true; root_directory = true;
} }
r = sd_device_get_property_value(dev, "ID_FS_TYPE", &type); if (sd_device_get_property_value(dev, "ID_FS_TYPE", &type) >= 0) {
if (r >= 0) {
r = fsck_exists(type); r = fsck_exists(type);
if (r < 0) if (r < 0)
log_warning_errno(r, "Couldn't detect if fsck.%s may be used for %s, proceeding: %m", type, device); log_warning_errno(r, "Couldn't detect if fsck.%s may be used for %s, proceeding: %m", type, device);

View file

@ -39,16 +39,13 @@ static bool arg_legend = true;
static bool arg_all = false; static bool arg_all = false;
static char *link_get_type_string(unsigned short iftype, sd_device *d) { static char *link_get_type_string(unsigned short iftype, sd_device *d) {
const char *t; const char *t, *devtype;
char *p; char *p;
if (d) { if (d &&
const char *devtype = NULL; sd_device_get_devtype(d, &devtype) >= 0 &&
!isempty(devtype))
(void) sd_device_get_devtype(d, &devtype); return strdup(devtype);
if (!isempty(devtype))
return strdup(devtype);
}
t = arphrd_to_name(iftype); t = arphrd_to_name(iftype);
if (!t) if (!t)
@ -768,12 +765,10 @@ static int link_status_one(
(void) sd_device_get_property_value(d, "ID_NET_DRIVER", &driver); (void) sd_device_get_property_value(d, "ID_NET_DRIVER", &driver);
(void) sd_device_get_property_value(d, "ID_PATH", &path); (void) sd_device_get_property_value(d, "ID_PATH", &path);
r = sd_device_get_property_value(d, "ID_VENDOR_FROM_DATABASE", &vendor); if (sd_device_get_property_value(d, "ID_VENDOR_FROM_DATABASE", &vendor) < 0)
if (r < 0)
(void) sd_device_get_property_value(d, "ID_VENDOR", &vendor); (void) sd_device_get_property_value(d, "ID_VENDOR", &vendor);
r = sd_device_get_property_value(d, "ID_MODEL_FROM_DATABASE", &model); if (sd_device_get_property_value(d, "ID_MODEL_FROM_DATABASE", &model) < 0)
if (r < 0)
(void) sd_device_get_property_value(d, "ID_MODEL", &model); (void) sd_device_get_property_value(d, "ID_MODEL", &model);
} }