summaryrefslogtreecommitdiffstats
path: root/drivers/block/mtip32xx
diff options
context:
space:
mode:
authorSachin Shukla <sachin.s5@samsung.com>2016-11-11 04:04:51 -0500
committerJens Axboe <axboe@fb.com>2016-11-11 15:37:04 -0500
commitb425b0201e89e6509032985532a33f1f92ac62a6 (patch)
tree0d53ebcb95ebc4f9e7763dce80f7834666c3d094 /drivers/block/mtip32xx
parent066a4a73cee9a44a906b98825e70c47de5bd8b5c (diff)
Block: mtip32xx: Improvement in code readability when memdup_user() fails.
There is no need to call kfree() if memdup_user() fails, as no memory was allocated and the error in the error-valued pointer should be returned. Signed-off-by: Sachin Shukla <sachin.s5@samsung.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/mtip32xx')
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 3cfd879267b2..cfe0108a7d30 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2035,18 +2035,14 @@ static int exec_drive_taskfile(struct driver_data *dd,
2035 taskout = req_task->out_size; 2035 taskout = req_task->out_size;
2036 taskin = req_task->in_size; 2036 taskin = req_task->in_size;
2037 /* 130560 = 512 * 0xFF*/ 2037 /* 130560 = 512 * 0xFF*/
2038 if (taskin > 130560 || taskout > 130560) { 2038 if (taskin > 130560 || taskout > 130560)
2039 err = -EINVAL; 2039 return -EINVAL;
2040 goto abort;
2041 }
2042 2040
2043 if (taskout) { 2041 if (taskout) {
2044 outbuf = memdup_user(buf + outtotal, taskout); 2042 outbuf = memdup_user(buf + outtotal, taskout);
2045 if (IS_ERR(outbuf)) { 2043 if (IS_ERR(outbuf))
2046 err = PTR_ERR(outbuf); 2044 return PTR_ERR(outbuf);
2047 outbuf = NULL; 2045
2048 goto abort;
2049 }
2050 outbuf_dma = pci_map_single(dd->pdev, 2046 outbuf_dma = pci_map_single(dd->pdev,
2051 outbuf, 2047 outbuf,
2052 taskout, 2048 taskout,