diff mbox

[v2,1/2] blockjob: assert(cb) when create job

Message ID 1466672241-22485-2-git-send-email-xiecl.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Changlong Xie June 23, 2016, 8:57 a.m. UTC
Callback for block job should always exist

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
 block/backup.c | 1 -
 blockjob.c     | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Cody June 29, 2016, 2:56 a.m. UTC | #1
On Thu, Jun 23, 2016 at 04:57:20PM +0800, Changlong Xie wrote:
> Callback for block job should always exist
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>

Reviewed-by: Jeff Cody <jcody@redhat.com>

> ---
>  block/backup.c | 1 -
>  blockjob.c     | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/backup.c b/block/backup.c
> index 581269b..f87f8d5 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -489,7 +489,6 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
>  
>      assert(bs);
>      assert(target);
> -    assert(cb);
>  
>      if (bs == target) {
>          error_setg(errp, "Source and target cannot be the same");
> diff --git a/blockjob.c b/blockjob.c
> index 90c4e26..205da9d 100644
> --- a/blockjob.c
> +++ b/blockjob.c
> @@ -110,6 +110,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
>      BlockBackend *blk;
>      BlockJob *job;
>  
> +    assert(cb);
>      if (bs->job) {
>          error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
>          return NULL;
> -- 
> 1.9.3
> 
> 
>
diff mbox

Patch

diff --git a/block/backup.c b/block/backup.c
index 581269b..f87f8d5 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -489,7 +489,6 @@  void backup_start(BlockDriverState *bs, BlockDriverState *target,
 
     assert(bs);
     assert(target);
-    assert(cb);
 
     if (bs == target) {
         error_setg(errp, "Source and target cannot be the same");
diff --git a/blockjob.c b/blockjob.c
index 90c4e26..205da9d 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -110,6 +110,7 @@  void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
     BlockBackend *blk;
     BlockJob *job;
 
+    assert(cb);
     if (bs->job) {
         error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
         return NULL;