Commit 667de9e8 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Driver class: remove possible oops

This happens when the device associated with a class device goes away before
the class does.
parent 6746ea4d
...@@ -155,8 +155,7 @@ static int class_device_dev_link(struct class_device * class_dev) ...@@ -155,8 +155,7 @@ static int class_device_dev_link(struct class_device * class_dev)
static void class_device_dev_unlink(struct class_device * class_dev) static void class_device_dev_unlink(struct class_device * class_dev)
{ {
if (class_dev->dev) sysfs_remove_link(&class_dev->kobj, "device");
sysfs_remove_link(&class_dev->kobj, "device");
} }
static int class_device_driver_link(struct class_device * class_dev) static int class_device_driver_link(struct class_device * class_dev)
...@@ -169,8 +168,7 @@ static int class_device_driver_link(struct class_device * class_dev) ...@@ -169,8 +168,7 @@ static int class_device_driver_link(struct class_device * class_dev)
static void class_device_driver_unlink(struct class_device * class_dev) static void class_device_driver_unlink(struct class_device * class_dev)
{ {
if ((class_dev->dev) && (class_dev->dev->driver)) sysfs_remove_link(&class_dev->kobj, "driver");
sysfs_remove_link(&class_dev->kobj, "driver");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment