aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/endpoint.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 40ba76a17571..3b2d137912be 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -223,7 +223,7 @@ int usb_create_ep_files(struct device *parent,
223 ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL); 223 ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);
224 if (!ep_dev) { 224 if (!ep_dev) {
225 retval = -ENOMEM; 225 retval = -ENOMEM;
226 goto exit; 226 goto error_alloc;
227 } 227 }
228 228
229 /* fun calculation to determine the minor of this endpoint */ 229 /* fun calculation to determine the minor of this endpoint */
@@ -241,33 +241,31 @@ int usb_create_ep_files(struct device *parent,
241 241
242 retval = device_register(&ep_dev->dev); 242 retval = device_register(&ep_dev->dev);
243 if (retval) 243 if (retval)
244 goto error; 244 goto error_register;
245 retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); 245 retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
246 if (retval) 246 if (retval)
247 goto error_group; 247 goto error_group;
248 248
249 endpoint->ep_dev = ep_dev;
250
251 /* create the symlink to the old-style "ep_XX" directory */ 249 /* create the symlink to the old-style "ep_XX" directory */
252 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); 250 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress);
253 retval = sysfs_create_link(&parent->kobj, 251 retval = sysfs_create_link(&parent->kobj, &ep_dev->dev.kobj, name);
254 &endpoint->ep_dev->dev.kobj, name);
255 if (retval) 252 if (retval)
256 goto error_link; 253 goto error_link;
257exit: 254 endpoint->ep_dev = ep_dev;
258 return retval; 255 return retval;
259 256
260error_link: 257error_link:
261 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); 258 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
262
263error_group: 259error_group:
264 device_unregister(&ep_dev->dev); 260 device_unregister(&ep_dev->dev);
265 endpoint->ep_dev = NULL;
266 destroy_endpoint_class(); 261 destroy_endpoint_class();
267 return retval; 262 return retval;
268error: 263
264error_register:
269 kfree(ep_dev); 265 kfree(ep_dev);
266error_alloc:
270 destroy_endpoint_class(); 267 destroy_endpoint_class();
268exit:
271 return retval; 269 return retval;
272} 270}
273 271