From a1008b2dabb5802f9083bed10f021d7e708b154a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 28 Sep 2022 18:12:43 +0900 Subject: udev-builtin-net_id: various coding style cleanups --- src/udev/udev-builtin-net_id.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/udev/udev-builtin-net_id.c') diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index b8b8bfae36..4936ba518a 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -299,6 +299,8 @@ static int is_pci_multifunction(sd_device *dev) { size_t len; int r; + assert(dev); + r = sd_device_get_syspath(dev, &syspath); if (r < 0) return r; @@ -319,17 +321,16 @@ static int is_pci_multifunction(sd_device *dev) { } static bool is_pci_ari_enabled(sd_device *dev) { - const char *a; - - if (sd_device_get_sysattr_value(dev, "ari_enabled", &a) < 0) - return false; + assert(dev); - return streq(a, "1"); + return device_get_sysattr_bool(dev, "ari_enabled") > 0; } static bool is_pci_bridge(sd_device *dev) { const char *v, *p; + assert(dev); + if (sd_device_get_sysattr_value(dev, "modalias", &v) < 0) return false; -- cgit v1.2.3