diff options
-rw-r--r-- | block/bsg.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/block/bsg.c b/block/bsg.c index e2c65a150a79..b413318a7c5d 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -368,7 +368,7 @@ static struct bsg_command *bsg_next_done_cmd(struct bsg_device *bd) | |||
368 | 368 | ||
369 | spin_lock_irq(&bd->lock); | 369 | spin_lock_irq(&bd->lock); |
370 | if (bd->done_cmds) { | 370 | if (bd->done_cmds) { |
371 | bc = list_entry(bd->done_list.next, struct bsg_command, list); | 371 | bc = list_first_entry(&bd->done_list, struct bsg_command, list); |
372 | list_del(&bc->list); | 372 | list_del(&bc->list); |
373 | bd->done_cmds--; | 373 | bd->done_cmds--; |
374 | } | 374 | } |
@@ -772,21 +772,19 @@ static struct bsg_device *bsg_add_device(struct inode *inode, | |||
772 | 772 | ||
773 | static struct bsg_device *__bsg_get_device(int minor) | 773 | static struct bsg_device *__bsg_get_device(int minor) |
774 | { | 774 | { |
775 | struct bsg_device *bd = NULL; | 775 | struct bsg_device *bd; |
776 | struct hlist_node *entry; | 776 | struct hlist_node *entry; |
777 | 777 | ||
778 | mutex_lock(&bsg_mutex); | 778 | mutex_lock(&bsg_mutex); |
779 | 779 | ||
780 | hlist_for_each(entry, bsg_dev_idx_hash(minor)) { | 780 | hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) { |
781 | bd = hlist_entry(entry, struct bsg_device, dev_list); | ||
782 | if (bd->minor == minor) { | 781 | if (bd->minor == minor) { |
783 | atomic_inc(&bd->ref_count); | 782 | atomic_inc(&bd->ref_count); |
784 | break; | 783 | goto found; |
785 | } | 784 | } |
786 | |||
787 | bd = NULL; | ||
788 | } | 785 | } |
789 | 786 | bd = NULL; | |
787 | found: | ||
790 | mutex_unlock(&bsg_mutex); | 788 | mutex_unlock(&bsg_mutex); |
791 | return bd; | 789 | return bd; |
792 | } | 790 | } |