Commit b425b020 authored by Sachin Shukla's avatar Sachin Shukla Committed by Jens Axboe

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: default avatarSachin Shukla <sachin.s5@samsung.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 066a4a73
...@@ -2035,18 +2035,14 @@ static int exec_drive_taskfile(struct driver_data *dd, ...@@ -2035,18 +2035,14 @@ static int exec_drive_taskfile(struct driver_data *dd,
taskout = req_task->out_size; taskout = req_task->out_size;
taskin = req_task->in_size; taskin = req_task->in_size;
/* 130560 = 512 * 0xFF*/ /* 130560 = 512 * 0xFF*/
if (taskin > 130560 || taskout > 130560) { if (taskin > 130560 || taskout > 130560)
err = -EINVAL; return -EINVAL;
goto abort;
}
if (taskout) { if (taskout) {
outbuf = memdup_user(buf + outtotal, taskout); outbuf = memdup_user(buf + outtotal, taskout);
if (IS_ERR(outbuf)) { if (IS_ERR(outbuf))
err = PTR_ERR(outbuf); return PTR_ERR(outbuf);
outbuf = NULL;
goto abort;
}
outbuf_dma = pci_map_single(dd->pdev, outbuf_dma = pci_map_single(dd->pdev,
outbuf, outbuf,
taskout, taskout,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment