[v2,2/6] test: fence: Turn class member variable into local variable
diff mbox series

Message ID 20240529154341.10426-3-laurent.pinchart@ideasonboard.com
State Accepted
Commit c44457957e04b4aba18849c94b51c6a69e6801b3
Headers show
Series
  • vimc scaling improvements
Related show

Commit Message

Laurent Pinchart May 29, 2024, 3:43 p.m. UTC
The fence_ class member variable is only used locally in the
FenceTest::run() function. Make it a local variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 test/fence.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Dan Scally May 31, 2024, 2:19 p.m. UTC | #1
Hi Laurent

On 29/05/2024 16:43, Laurent Pinchart wrote:
> The fence_ class member variable is only used locally in the
> FenceTest::run() function. Make it a local variable.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
>   test/fence.cpp | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/fence.cpp b/test/fence.cpp
> index ada650ff2417..c282886287aa 100644
> --- a/test/fence.cpp
> +++ b/test/fence.cpp
> @@ -43,7 +43,6 @@ private:
>   
>   	void signalFence();
>   
> -	std::unique_ptr<Fence> fence_;
>   	EventDispatcher *dispatcher_;
>   	UniqueFD eventFd_;
>   	UniqueFD eventFd2_;
> @@ -274,13 +273,14 @@ int FenceTest::run()
>   		int ret;
>   		if (i == expiredRequestId_) {
>   			/* This request will have a fence, and it will expire. */
> -			fence_ = std::make_unique<Fence>(std::move(eventFd_));
> -			if (!fence_->isValid()) {
> +			std::unique_ptr<Fence> fence =
> +				std::make_unique<Fence>(std::move(eventFd_));
> +			if (!fence->isValid()) {
>   				cerr << "Fence should be valid" << endl;
>   				return TestFail;
>   			}
>   
> -			ret = request->addBuffer(stream_, buffer.get(), std::move(fence_));
> +			ret = request->addBuffer(stream_, buffer.get(), std::move(fence));
>   		} else {
>   			/* All other requests will have no Fence. */
>   			ret = request->addBuffer(stream_, buffer.get());

Patch
diff mbox series

diff --git a/test/fence.cpp b/test/fence.cpp
index ada650ff2417..c282886287aa 100644
--- a/test/fence.cpp
+++ b/test/fence.cpp
@@ -43,7 +43,6 @@  private:
 
 	void signalFence();
 
-	std::unique_ptr<Fence> fence_;
 	EventDispatcher *dispatcher_;
 	UniqueFD eventFd_;
 	UniqueFD eventFd2_;
@@ -274,13 +273,14 @@  int FenceTest::run()
 		int ret;
 		if (i == expiredRequestId_) {
 			/* This request will have a fence, and it will expire. */
-			fence_ = std::make_unique<Fence>(std::move(eventFd_));
-			if (!fence_->isValid()) {
+			std::unique_ptr<Fence> fence =
+				std::make_unique<Fence>(std::move(eventFd_));
+			if (!fence->isValid()) {
 				cerr << "Fence should be valid" << endl;
 				return TestFail;
 			}
 
-			ret = request->addBuffer(stream_, buffer.get(), std::move(fence_));
+			ret = request->addBuffer(stream_, buffer.get(), std::move(fence));
 		} else {
 			/* All other requests will have no Fence. */
 			ret = request->addBuffer(stream_, buffer.get());