From: Lennart Poettering Date: Mon, 4 Jun 2018 16:04:33 +0000 (+0200) Subject: core: modernize device_update_description() a bit X-Git-Tag: v239~123^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea8ec43bb5c6cfa9794cf6f292006b3aec82fc8c;p=thirdparty%2Fsystemd.git core: modernize device_update_description() a bit --- diff --git a/src/core/device.c b/src/core/device.c index 9d09a219d5d..ba69fdc70d3 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -324,19 +324,18 @@ static int device_update_description(Unit *u, struct udev_device *dev, const cha _cleanup_free_ char *j; j = strjoin(model, " ", label); - if (j) - r = unit_set_description(u, j); - else - r = -ENOMEM; + if (!j) + return log_oom(); + + r = unit_set_description(u, j); } else r = unit_set_description(u, model); } else r = unit_set_description(u, path); - if (r < 0) - log_unit_error_errno(u, r, "Failed to set device description: %m"); + return log_unit_error_errno(u, r, "Failed to set device description: %m"); - return r; + return 0; } static int device_add_udev_wants(Unit *u, struct udev_device *dev) {