qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 01/10] blockjob: remove unnecessary check


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 01/10] blockjob: remove unnecessary check
Date: Fri, 7 Apr 2017 19:54:40 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Hi Paolo,

On 03/23/2017 02:39 PM, Paolo Bonzini wrote:
!job is always checked prior to the call, drop it from here.

I agree with you this is currently true, *but* block_job_user_paused() is exported in "block/blockjob.h" so any future access (external to blockdev.c) could eventually happen with job == NULL. I'd NACK this patch for for this reason, but I checked and there is no access to this function outside of blockdev.c, so I think the best is to make block_job_user_paused() static (removing the public declaration) and safely drop the !job check, what do you think?


Signed-off-by: Paolo Bonzini <address@hidden>
---
 blockjob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/blockjob.c b/blockjob.c
index 9b619f385..a9fb624 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -480,7 +480,7 @@ static bool block_job_should_pause(BlockJob *job)

 bool block_job_user_paused(BlockJob *job)
 {
-    return job ? job->user_paused : 0;
+    return job->user_paused;
 }

 void coroutine_fn block_job_pause_point(BlockJob *job)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]