]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/memstick-mspro_block-fix-an-error-code-in-mspro_block_issue_req.patch
drop queue-4.19/drm-amdgpu-soc15-skip-reset-on-init.patch
[thirdparty/kernel/stable-queue.git] / queue-5.1 / memstick-mspro_block-fix-an-error-code-in-mspro_block_issue_req.patch
1 From 61009f82a93f7c0b33cd9b3b263a6ab48f8b49d4 Mon Sep 17 00:00:00 2001
2 From: Dan Carpenter <dan.carpenter@oracle.com>
3 Date: Fri, 10 May 2019 14:24:41 +0300
4 Subject: memstick: mspro_block: Fix an error code in mspro_block_issue_req()
5
6 From: Dan Carpenter <dan.carpenter@oracle.com>
7
8 commit 61009f82a93f7c0b33cd9b3b263a6ab48f8b49d4 upstream.
9
10 We accidentally changed the error code from -EAGAIN to 1 when we did the
11 blk-mq conversion.
12
13 Maybe a contributing factor to this mistake is that it wasn't obvious
14 that the "while (chunk) {" condition is always true. I have cleaned
15 that up as well.
16
17 Fixes: d0be12274dad ("mspro_block: convert to blk-mq")
18 Cc: stable@vger.kernel.org
19 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
20 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 drivers/memstick/core/mspro_block.c | 13 ++++++-------
25 1 file changed, 6 insertions(+), 7 deletions(-)
26
27 --- a/drivers/memstick/core/mspro_block.c
28 +++ b/drivers/memstick/core/mspro_block.c
29 @@ -694,13 +694,13 @@ static void h_mspro_block_setup_cmd(stru
30
31 /*** Data transfer ***/
32
33 -static int mspro_block_issue_req(struct memstick_dev *card, bool chunk)
34 +static int mspro_block_issue_req(struct memstick_dev *card)
35 {
36 struct mspro_block_data *msb = memstick_get_drvdata(card);
37 u64 t_off;
38 unsigned int count;
39
40 - while (chunk) {
41 + while (true) {
42 msb->current_page = 0;
43 msb->current_seg = 0;
44 msb->seg_count = blk_rq_map_sg(msb->block_req->q,
45 @@ -709,6 +709,7 @@ static int mspro_block_issue_req(struct
46
47 if (!msb->seg_count) {
48 unsigned int bytes = blk_rq_cur_bytes(msb->block_req);
49 + bool chunk;
50
51 chunk = blk_update_request(msb->block_req,
52 BLK_STS_RESOURCE,
53 @@ -718,7 +719,7 @@ static int mspro_block_issue_req(struct
54 __blk_mq_end_request(msb->block_req,
55 BLK_STS_RESOURCE);
56 msb->block_req = NULL;
57 - break;
58 + return -EAGAIN;
59 }
60
61 t_off = blk_rq_pos(msb->block_req);
62 @@ -735,8 +736,6 @@ static int mspro_block_issue_req(struct
63 memstick_new_req(card->host);
64 return 0;
65 }
66 -
67 - return 1;
68 }
69
70 static int mspro_block_complete_req(struct memstick_dev *card, int error)
71 @@ -779,7 +778,7 @@ static int mspro_block_complete_req(stru
72 chunk = blk_update_request(msb->block_req,
73 errno_to_blk_status(error), t_len);
74 if (chunk) {
75 - error = mspro_block_issue_req(card, chunk);
76 + error = mspro_block_issue_req(card);
77 if (!error)
78 goto out;
79 } else {
80 @@ -849,7 +848,7 @@ static blk_status_t mspro_queue_rq(struc
81 msb->block_req = bd->rq;
82 blk_mq_start_request(bd->rq);
83
84 - if (mspro_block_issue_req(card, true))
85 + if (mspro_block_issue_req(card))
86 msb->block_req = NULL;
87
88 spin_unlock_irq(&msb->q_lock);