diff options
Diffstat (limited to 'drivers/usb/host/uhci-debug.c')
-rw-r--r-- | drivers/usb/host/uhci-debug.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index 98cf0b26b968..6e7fb5f38db6 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | #include "uhci-hcd.h" | 18 | #include "uhci-hcd.h" |
19 | 19 | ||
20 | #define uhci_debug_operations (* (const struct file_operations *) NULL) | ||
21 | static struct dentry *uhci_debugfs_root; | 20 | static struct dentry *uhci_debugfs_root; |
22 | 21 | ||
23 | #ifdef DEBUG | 22 | #ifdef DEBUG |
@@ -495,18 +494,16 @@ static int uhci_debug_open(struct inode *inode, struct file *file) | |||
495 | { | 494 | { |
496 | struct uhci_hcd *uhci = inode->i_private; | 495 | struct uhci_hcd *uhci = inode->i_private; |
497 | struct uhci_debug *up; | 496 | struct uhci_debug *up; |
498 | int ret = -ENOMEM; | ||
499 | unsigned long flags; | 497 | unsigned long flags; |
500 | 498 | ||
501 | lock_kernel(); | ||
502 | up = kmalloc(sizeof(*up), GFP_KERNEL); | 499 | up = kmalloc(sizeof(*up), GFP_KERNEL); |
503 | if (!up) | 500 | if (!up) |
504 | goto out; | 501 | return -ENOMEM; |
505 | 502 | ||
506 | up->data = kmalloc(MAX_OUTPUT, GFP_KERNEL); | 503 | up->data = kmalloc(MAX_OUTPUT, GFP_KERNEL); |
507 | if (!up->data) { | 504 | if (!up->data) { |
508 | kfree(up); | 505 | kfree(up); |
509 | goto out; | 506 | return -ENOMEM; |
510 | } | 507 | } |
511 | 508 | ||
512 | up->size = 0; | 509 | up->size = 0; |
@@ -517,10 +514,7 @@ static int uhci_debug_open(struct inode *inode, struct file *file) | |||
517 | 514 | ||
518 | file->private_data = up; | 515 | file->private_data = up; |
519 | 516 | ||
520 | ret = 0; | 517 | return 0; |
521 | out: | ||
522 | unlock_kernel(); | ||
523 | return ret; | ||
524 | } | 518 | } |
525 | 519 | ||
526 | static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) | 520 | static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) |
@@ -528,9 +522,9 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) | |||
528 | struct uhci_debug *up; | 522 | struct uhci_debug *up; |
529 | loff_t new = -1; | 523 | loff_t new = -1; |
530 | 524 | ||
531 | lock_kernel(); | ||
532 | up = file->private_data; | 525 | up = file->private_data; |
533 | 526 | ||
527 | /* XXX: atomic 64bit seek access, but that needs to be fixed in the VFS */ | ||
534 | switch (whence) { | 528 | switch (whence) { |
535 | case 0: | 529 | case 0: |
536 | new = off; | 530 | new = off; |
@@ -539,11 +533,10 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) | |||
539 | new = file->f_pos + off; | 533 | new = file->f_pos + off; |
540 | break; | 534 | break; |
541 | } | 535 | } |
542 | if (new < 0 || new > up->size) { | 536 | |
543 | unlock_kernel(); | 537 | if (new < 0 || new > up->size) |
544 | return -EINVAL; | 538 | return -EINVAL; |
545 | } | 539 | |
546 | unlock_kernel(); | ||
547 | return (file->f_pos = new); | 540 | return (file->f_pos = new); |
548 | } | 541 | } |
549 | 542 | ||
@@ -564,7 +557,6 @@ static int uhci_debug_release(struct inode *inode, struct file *file) | |||
564 | return 0; | 557 | return 0; |
565 | } | 558 | } |
566 | 559 | ||
567 | #undef uhci_debug_operations | ||
568 | static const struct file_operations uhci_debug_operations = { | 560 | static const struct file_operations uhci_debug_operations = { |
569 | .owner = THIS_MODULE, | 561 | .owner = THIS_MODULE, |
570 | .open = uhci_debug_open, | 562 | .open = uhci_debug_open, |
@@ -572,6 +564,7 @@ static const struct file_operations uhci_debug_operations = { | |||
572 | .read = uhci_debug_read, | 564 | .read = uhci_debug_read, |
573 | .release = uhci_debug_release, | 565 | .release = uhci_debug_release, |
574 | }; | 566 | }; |
567 | #define UHCI_DEBUG_OPS | ||
575 | 568 | ||
576 | #endif /* CONFIG_DEBUG_FS */ | 569 | #endif /* CONFIG_DEBUG_FS */ |
577 | 570 | ||