[libvirt PATCH] qemu: remove some unnecessary local variables

Laine Stump laine at redhat.com
Wed Oct 14 04:31:39 UTC 2020


On 10/13/20 5:14 PM, Jonathon Jongsma wrote:
> These variables seem to be left over from a previous refactoring and
> they don't add anything to the code.


Certainly the proof is in the compiling :-)

(it looks like it was probably *me* that left these useless variables in 
there about 1.5 years ago when I split all the unplug stuff into two 
pieces, and factored out some common code used by all different device 
types. See commit dd60bd62d and surrounding commits if you're interested...)


Reviewed-by: Laine Stump <laine at redhat.com> and pushed.


>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>   src/qemu/qemu_hotplug.c | 12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 2c184b9ba0..79fc8baa5c 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -5502,7 +5502,6 @@ qemuDomainDetachPrepRedirdev(virDomainObjPtr vm,
>                                virDomainRedirdevDefPtr match,
>                                virDomainRedirdevDefPtr *detach)
>   {
> -    virDomainRedirdevDefPtr redirdev;
>       ssize_t idx;
>   
>       if ((idx = virDomainRedirdevDefFind(vm->def, match)) < 0) {
> @@ -5511,7 +5510,7 @@ qemuDomainDetachPrepRedirdev(virDomainObjPtr vm,
>           return -1;
>       }
>   
> -    *detach = redirdev = vm->def->redirdevs[idx];
> +    *detach = vm->def->redirdevs[idx];
>   
>       return 0;
>   }
> @@ -5523,12 +5522,11 @@ qemuDomainDetachPrepNet(virDomainObjPtr vm,
>                           virDomainNetDefPtr *detach)
>   {
>       int detachidx;
> -    virDomainNetDefPtr net = NULL;
>   
>       if ((detachidx = virDomainNetFindIdx(vm->def, match)) < 0)
>           return -1;
>   
> -    *detach = net = vm->def->nets[detachidx];
> +    *detach = vm->def->nets[detachidx];
>   
>       return 0;
>   }
> @@ -5598,7 +5596,6 @@ qemuDomainDetachPrepRNG(virDomainObjPtr vm,
>                           virDomainRNGDefPtr *detach)
>   {
>       ssize_t idx;
> -    virDomainRNGDefPtr rng;
>   
>       if ((idx = virDomainRNGFind(vm->def, match)) < 0) {
>           virReportError(VIR_ERR_DEVICE_MISSING,
> @@ -5608,7 +5605,7 @@ qemuDomainDetachPrepRNG(virDomainObjPtr vm,
>           return -1;
>       }
>   
> -    *detach = rng = vm->def->rngs[idx];
> +    *detach = vm->def->rngs[idx];
>   
>       return 0;
>   }
> @@ -5619,7 +5616,6 @@ qemuDomainDetachPrepMemory(virDomainObjPtr vm,
>                              virDomainMemoryDefPtr match,
>                              virDomainMemoryDefPtr *detach)
>   {
> -    virDomainMemoryDefPtr mem;
>       int idx;
>   
>       if (qemuDomainMemoryDeviceAlignSize(vm->def, match) < 0)
> @@ -5633,7 +5629,7 @@ qemuDomainDetachPrepMemory(virDomainObjPtr vm,
>           return -1;
>       }
>   
> -    *detach = mem = vm->def->mems[idx];
> +    *detach = vm->def->mems[idx];
>   
>       return 0;
>   }





More information about the libvir-list mailing list