From: matthieu castet <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>
Signed-off-by: Matthieu CASTET <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 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 5705298..f6b9f7e 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1648,16 +1648,12 @@ static struct attribute *attrs[] = {
        &dev_attr_stat_usunc.attr,
        &dev_attr_stat_dsunc.attr,
        &dev_attr_stat_firmid.attr,
+       NULL,
 };
 static struct attribute_group attr_grp = {
        .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,
                   const struct usb_device_id *id)
 {
@@ -1717,31 +1713,25 @@ static int uea_bind(struct usbatm_data *
                }
        }
 
+       ret = sysfs_create_group(&intf->dev.kobj, &attr_grp);
+       if (ret < 0)
+               goto error;
+
        ret = uea_boot(sc);
-       if (ret < 0) {
-               kfree(sc);
-               return ret;
-       }
+       if (ret < 0)
+               goto error;
 
-       ret = create_fs_entries(intf);
-       if (ret) {
-               uea_stop(sc);
-               kfree(sc);
-               return ret;
-       }
        return 0;
-}
-
-static void destroy_fs_entries(struct usb_interface *intf)
-{
-       sysfs_remove_group(&intf->dev.kobj, &attr_grp);
+error:
+       kfree(sc);
+       return ret;
 }
 
 static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf)
 {
        struct uea_softc *sc = usbatm->driver_data;
 
-       destroy_fs_entries(intf);
+       sysfs_remove_group(&intf->dev.kobj, &attr_grp);
        uea_stop(sc);
        kfree(sc);
 }
-- 
1.4.2.4


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to