Commit 9ab99c8c authored by matthieu castet's avatar matthieu castet Committed by Greg Kroah-Hartman

UEAGLE: fix ueagle-atm Oops

The array of attribute passed to sysfs_create_group() must be
NULL-terminated.

The sysfs entries are created before the start of the modem state machine
to avoid to stop it in case of errors in sysfs creation.  Also
{destroy,create}_fs_entries are removed as they do nothing.
Signed-off-by: default avatarLaurent Riffard <laurent.riffard@free.fr>
Signed-off-by: default avatarMatthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent deb8ee43
...@@ -1648,16 +1648,12 @@ static struct attribute *attrs[] = { ...@@ -1648,16 +1648,12 @@ static struct attribute *attrs[] = {
&dev_attr_stat_usunc.attr, &dev_attr_stat_usunc.attr,
&dev_attr_stat_dsunc.attr, &dev_attr_stat_dsunc.attr,
&dev_attr_stat_firmid.attr, &dev_attr_stat_firmid.attr,
NULL,
}; };
static struct attribute_group attr_grp = { static struct attribute_group attr_grp = {
.attrs = attrs, .attrs = attrs,
}; };
static int create_fs_entries(struct usb_interface *intf)
{
return sysfs_create_group(&intf->dev.kobj, &attr_grp);
}
static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
...@@ -1717,31 +1713,25 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, ...@@ -1717,31 +1713,25 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
} }
} }
ret = sysfs_create_group(&intf->dev.kobj, &attr_grp);
if (ret < 0)
goto error;
ret = uea_boot(sc); ret = uea_boot(sc);
if (ret < 0) { if (ret < 0)
kfree(sc); goto error;
return ret;
}
ret = create_fs_entries(intf);
if (ret) {
uea_stop(sc);
kfree(sc);
return ret;
}
return 0; return 0;
} error:
kfree(sc);
static void destroy_fs_entries(struct usb_interface *intf) return ret;
{
sysfs_remove_group(&intf->dev.kobj, &attr_grp);
} }
static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf) static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf)
{ {
struct uea_softc *sc = usbatm->driver_data; struct uea_softc *sc = usbatm->driver_data;
destroy_fs_entries(intf); sysfs_remove_group(&intf->dev.kobj, &attr_grp);
uea_stop(sc); uea_stop(sc);
kfree(sc); kfree(sc);
} }
......
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