summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedor Pchelkin <pchelkin@ispras.ru>2024-05-04 14:47:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-11 12:51:21 +0200
commit8108b176ea37fa86c1c2b25335eec8b9177a212a (patch)
treee005d196e9f20bc6bb88cad8c6fcf35e7b865167
parentf7b20274355ed8c00d98735a7d973d11dc703fb8 (diff)
dma-mapping: benchmark: avoid needless copy_to_user if benchmark fails
[ Upstream commit f7c9ccaadffd13066353332c13d7e9bf73b8f92d ] If do_map_benchmark() has failed, there is nothing useful to copy back to userspace. Suggested-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Acked-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--kernel/dma/map_benchmark.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
index f7f3d14fa69a..4950e0b622b1 100644
--- a/kernel/dma/map_benchmark.c
+++ b/kernel/dma/map_benchmark.c
@@ -256,6 +256,9 @@ static long map_benchmark_ioctl(struct file *file, unsigned int cmd,
* dma_mask changed by benchmark
*/
dma_set_mask(map->dev, old_dma_mask);
+
+ if (ret)
+ return ret;
break;
default:
return -EINVAL;