[libvirt] [PATCH 1/2] qemu: avoid dead store in doPeer2PeerMigrate3

Eric Blake eblake at redhat.com
Thu Aug 25 19:29:52 UTC 2011


On 08/16/2011 03:24 AM, Alex Jia wrote:
> * src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
>    clang warning.
>
> Detected by ccc-analyzer:
>
>    CC     libvirt_driver_qemu_la-qemu_migration.lo
> qemu/qemu_migration.c:2046:5: warning: Value stored to 'ret' is never read
>      ret = qemuMigrationConfirm(driver, sconn, vm,
>      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ---
>   src/qemu/qemu_migration.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 5510493..469bb4a 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2050,6 +2050,9 @@ finish:
>        * do, but fortunately worst case is that there is a
>        * domain left in 'paused' state on source.
>        */
> +    if (ret<  0)
> +        VIR_WARN("Guest %s probably left in 'paused' state on source",
> +                 vm->def->name);

The discussion on this died out, and I was left with the conclusion that 
if the overall migration returns success, then VIR_WARN is indeed the 
only way to log an error (using virterror.c only goes into the log on 
failures, not on success); meanwhile your patch does indeed silence the 
static analyzer.  So:

ACK, and both of your patches are now pushed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list