From ef04d0578f5bd96e3fdaaf119f008c5852afa092 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 13 Oct 2022 13:48:26 +0100 Subject: [PATCH] trivial: Fix a critical warning when using old kernel versions --- libfwupdplugin/fu-i2c-device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libfwupdplugin/fu-i2c-device.c b/libfwupdplugin/fu-i2c-device.c index 09523f579..c8b29e791 100644 --- a/libfwupdplugin/fu-i2c-device.c +++ b/libfwupdplugin/fu-i2c-device.c @@ -131,8 +131,9 @@ fu_i2c_device_probe(FuDevice *device, GError **error) /* get bus number out of sysfs path */ udev_parent = g_udev_device_get_parent(udev_device); - devname = g_path_get_basename(g_udev_device_get_sysfs_path(udev_parent)); - if (g_str_has_prefix(devname, "i2c-")) { + if (udev_parent != NULL) + devname = g_path_get_basename(g_udev_device_get_sysfs_path(udev_parent)); + if (devname != NULL && g_str_has_prefix(devname, "i2c-")) { guint64 tmp64 = 0; g_autoptr(GError) error_local = NULL; if (!fu_strtoull(devname + 4, &tmp64, 0, G_MAXUINT, &error_local)) {