]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/device.c
unit: unify some code with new unit_new_for_name() call
[thirdparty/systemd.git] / src / core / device.c
index 8a3e888e5eb9e3bbbf3f0bd3c393b69693c68a55..bd87a447cda8d9453e3e4db14f5760f45625b1b1 100644 (file)
@@ -331,11 +331,7 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa
         if (!u) {
                 delete = true;
 
-                u = unit_new(m, sizeof(Device));
-                if (!u)
-                        return log_oom();
-
-                r = unit_add_name(u, e);
+                r = unit_new_for_name(m, sizeof(Device), e, &u);
                 if (r < 0)
                         goto fail;