diff options
author | matthieu castet <castet.matthieu@free.fr> | 2006-10-11 17:20:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-17 17:46:33 -0400 |
commit | 9ab99c8c513313c1c5931bdbd27dcc4bc7a3b7cd (patch) | |
tree | 762680610ec09ed8d1a45aafe6c4fb6131418af8 | |
parent | deb8ee43a23d48116cb23eb8dd1de2348efb1e80 (diff) |
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: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 570529842231..f6b9f7e1f716 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -1648,16 +1648,12 @@ static struct attribute *attrs[] = { | |||
1648 | &dev_attr_stat_usunc.attr, | 1648 | &dev_attr_stat_usunc.attr, |
1649 | &dev_attr_stat_dsunc.attr, | 1649 | &dev_attr_stat_dsunc.attr, |
1650 | &dev_attr_stat_firmid.attr, | 1650 | &dev_attr_stat_firmid.attr, |
1651 | NULL, | ||
1651 | }; | 1652 | }; |
1652 | static struct attribute_group attr_grp = { | 1653 | static struct attribute_group attr_grp = { |
1653 | .attrs = attrs, | 1654 | .attrs = attrs, |
1654 | }; | 1655 | }; |
1655 | 1656 | ||
1656 | static int create_fs_entries(struct usb_interface *intf) | ||
1657 | { | ||
1658 | return sysfs_create_group(&intf->dev.kobj, &attr_grp); | ||
1659 | } | ||
1660 | |||
1661 | static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, | 1657 | static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, |
1662 | const struct usb_device_id *id) | 1658 | const struct usb_device_id *id) |
1663 | { | 1659 | { |
@@ -1717,31 +1713,25 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, | |||
1717 | } | 1713 | } |
1718 | } | 1714 | } |
1719 | 1715 | ||
1716 | ret = sysfs_create_group(&intf->dev.kobj, &attr_grp); | ||
1717 | if (ret < 0) | ||
1718 | goto error; | ||
1719 | |||
1720 | ret = uea_boot(sc); | 1720 | ret = uea_boot(sc); |
1721 | if (ret < 0) { | 1721 | if (ret < 0) |
1722 | kfree(sc); | 1722 | goto error; |
1723 | return ret; | ||
1724 | } | ||
1725 | 1723 | ||
1726 | ret = create_fs_entries(intf); | ||
1727 | if (ret) { | ||
1728 | uea_stop(sc); | ||
1729 | kfree(sc); | ||
1730 | return ret; | ||
1731 | } | ||
1732 | return 0; | 1724 | return 0; |
1733 | } | 1725 | error: |
1734 | 1726 | kfree(sc); | |
1735 | static void destroy_fs_entries(struct usb_interface *intf) | 1727 | return ret; |
1736 | { | ||
1737 | sysfs_remove_group(&intf->dev.kobj, &attr_grp); | ||
1738 | } | 1728 | } |
1739 | 1729 | ||
1740 | static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf) | 1730 | static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf) |
1741 | { | 1731 | { |
1742 | struct uea_softc *sc = usbatm->driver_data; | 1732 | struct uea_softc *sc = usbatm->driver_data; |
1743 | 1733 | ||
1744 | destroy_fs_entries(intf); | 1734 | sysfs_remove_group(&intf->dev.kobj, &attr_grp); |
1745 | uea_stop(sc); | 1735 | uea_stop(sc); |
1746 | kfree(sc); | 1736 | kfree(sc); |
1747 | } | 1737 | } |