summaryrefslogtreecommitdiff
path: root/udev/lib/libudev-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev/lib/libudev-device.c')
-rw-r--r--udev/lib/libudev-device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
index 00b9440386..578afe7ec2 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -346,8 +346,15 @@ int udev_device_get_properties(struct udev_device *udev_device,
const char *udev_device_get_driver(struct udev_device *udev_device)
{
+ char driver[NAME_SIZE];
+
if (udev_device == NULL)
return NULL;
+ if (udev_device->driver != NULL)
+ return udev_device->driver;
+ if (util_get_sys_driver(udev_device->udev, udev_device->devpath, driver, sizeof(driver)) < 2)
+ return NULL;
+ udev_device->driver = strdup(driver);
return udev_device->driver;
}