mirror of
https://github.com/systemd/systemd.git
synced 2025-08-30 05:49:54 +03:00
udev-event: drop unused assignments
clang's static analyzer reports: Value stored to 'l' is never read
This commit is contained in:
committed by
Luca Boccassi
parent
2d302d88e4
commit
971f369761
@ -247,13 +247,13 @@ static ssize_t udev_event_subst_format(
|
|||||||
r = sd_device_get_devpath(dev, &val);
|
r = sd_device_get_devpath(dev, &val);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_KERNEL:
|
case FORMAT_SUBST_KERNEL:
|
||||||
r = sd_device_get_sysname(dev, &val);
|
r = sd_device_get_sysname(dev, &val);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_KERNEL_NUMBER:
|
case FORMAT_SUBST_KERNEL_NUMBER:
|
||||||
r = sd_device_get_sysnum(dev, &val);
|
r = sd_device_get_sysnum(dev, &val);
|
||||||
@ -261,7 +261,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
goto null_terminate;
|
goto null_terminate;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_ID:
|
case FORMAT_SUBST_ID:
|
||||||
if (!event->dev_parent)
|
if (!event->dev_parent)
|
||||||
@ -269,7 +269,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
r = sd_device_get_sysname(event->dev_parent, &val);
|
r = sd_device_get_sysname(event->dev_parent, &val);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_DRIVER:
|
case FORMAT_SUBST_DRIVER:
|
||||||
if (!event->dev_parent)
|
if (!event->dev_parent)
|
||||||
@ -279,7 +279,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
goto null_terminate;
|
goto null_terminate;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_MAJOR:
|
case FORMAT_SUBST_MAJOR:
|
||||||
case FORMAT_SUBST_MINOR: {
|
case FORMAT_SUBST_MINOR: {
|
||||||
@ -288,7 +288,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
r = sd_device_get_devnum(dev, &devnum);
|
r = sd_device_get_devnum(dev, &devnum);
|
||||||
if (r < 0 && r != -ENOENT)
|
if (r < 0 && r != -ENOENT)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpyf(&s, l, "%u", r < 0 ? 0 : type == FORMAT_SUBST_MAJOR ? major(devnum) : minor(devnum));
|
strpcpyf(&s, l, "%u", r < 0 ? 0 : type == FORMAT_SUBST_MAJOR ? major(devnum) : minor(devnum));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FORMAT_SUBST_RESULT: {
|
case FORMAT_SUBST_RESULT: {
|
||||||
@ -307,7 +307,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
l = strpcpy(&s, l, event->program_result);
|
strpcpy(&s, l, event->program_result);
|
||||||
else {
|
else {
|
||||||
const char *start, *p;
|
const char *start, *p;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -329,11 +329,11 @@ static ssize_t udev_event_subst_format(
|
|||||||
start = p;
|
start = p;
|
||||||
/* %c{2+} copies the whole string from the second part on */
|
/* %c{2+} copies the whole string from the second part on */
|
||||||
if (has_plus)
|
if (has_plus)
|
||||||
l = strpcpy(&s, l, start);
|
strpcpy(&s, l, start);
|
||||||
else {
|
else {
|
||||||
while (*p && !strchr(WHITESPACE, *p))
|
while (*p && !strchr(WHITESPACE, *p))
|
||||||
p++;
|
p++;
|
||||||
l = strnpcpy(&s, l, start, p - start);
|
strnpcpy(&s, l, start, p - start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -367,7 +367,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
count = udev_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT);
|
count = udev_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
log_device_debug(dev, "%i character(s) replaced", count);
|
log_device_debug(dev, "%i character(s) replaced", count);
|
||||||
l = strpcpy(&s, l, vbuf);
|
strpcpy(&s, l, vbuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FORMAT_SUBST_PARENT:
|
case FORMAT_SUBST_PARENT:
|
||||||
@ -381,7 +381,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
goto null_terminate;
|
goto null_terminate;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val + STRLEN("/dev/"));
|
strpcpy(&s, l, val + STRLEN("/dev/"));
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_DEVNODE:
|
case FORMAT_SUBST_DEVNODE:
|
||||||
r = sd_device_get_devname(dev, &val);
|
r = sd_device_get_devname(dev, &val);
|
||||||
@ -389,34 +389,34 @@ static ssize_t udev_event_subst_format(
|
|||||||
goto null_terminate;
|
goto null_terminate;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_NAME:
|
case FORMAT_SUBST_NAME:
|
||||||
if (event->name)
|
if (event->name)
|
||||||
l = strpcpy(&s, l, event->name);
|
strpcpy(&s, l, event->name);
|
||||||
else if (sd_device_get_devname(dev, &val) >= 0)
|
else if (sd_device_get_devname(dev, &val) >= 0)
|
||||||
l = strpcpy(&s, l, val + STRLEN("/dev/"));
|
strpcpy(&s, l, val + STRLEN("/dev/"));
|
||||||
else {
|
else {
|
||||||
r = sd_device_get_sysname(dev, &val);
|
r = sd_device_get_sysname(dev, &val);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_LINKS:
|
case FORMAT_SUBST_LINKS:
|
||||||
FOREACH_DEVICE_DEVLINK(dev, val)
|
FOREACH_DEVICE_DEVLINK(dev, val)
|
||||||
if (s == dest)
|
if (s == dest)
|
||||||
l = strpcpy(&s, l, val + STRLEN("/dev/"));
|
strpcpy(&s, l, val + STRLEN("/dev/"));
|
||||||
else
|
else
|
||||||
l = strpcpyl(&s, l, " ", val + STRLEN("/dev/"), NULL);
|
strpcpyl(&s, l, " ", val + STRLEN("/dev/"), NULL);
|
||||||
if (s == dest)
|
if (s == dest)
|
||||||
goto null_terminate;
|
goto null_terminate;
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_ROOT:
|
case FORMAT_SUBST_ROOT:
|
||||||
l = strpcpy(&s, l, "/dev");
|
strpcpy(&s, l, "/dev");
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_SYS:
|
case FORMAT_SUBST_SYS:
|
||||||
l = strpcpy(&s, l, "/sys");
|
strpcpy(&s, l, "/sys");
|
||||||
break;
|
break;
|
||||||
case FORMAT_SUBST_ENV:
|
case FORMAT_SUBST_ENV:
|
||||||
if (isempty(attr))
|
if (isempty(attr))
|
||||||
@ -426,7 +426,7 @@ static ssize_t udev_event_subst_format(
|
|||||||
goto null_terminate;
|
goto null_terminate;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
l = strpcpy(&s, l, val);
|
strpcpy(&s, l, val);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert_not_reached("Unknown format substitution type");
|
assert_not_reached("Unknown format substitution type");
|
||||||
|
Reference in New Issue
Block a user