From: Yu Watanabe Date: Thu, 21 Jul 2022 23:48:33 +0000 (+0900) Subject: network: use device_unref_and_replace() X-Git-Tag: v252-rc1~593^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=853188db9085e3dbb90cb263bbafce0276479f62;p=thirdparty%2Fsystemd.git network: use device_unref_and_replace() --- diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 94ef20b3eaa..486ba3c1610 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1433,9 +1433,7 @@ static int link_initialized(Link *link, sd_device *device) { /* Always replace with the new sd_device object. As the sysname (and possibly other properties * or sysattrs) may be outdated. */ - sd_device_ref(device); - sd_device_unref(link->sd_device); - link->sd_device = device; + device_unref_and_replace(link->sd_device, device); /* Do not ignore unamanaged state case here. If an interface is renamed after being once * configured, and the corresponding .network file has Name= in [Match] section, then the