On Thu, Jun 30, 2016 at 12:34 PM +0200, Peter Krempa <pkrempa(a)redhat.com> wrote:
> qemuDomainObjPrivatePtr priv = vm->privateData;
> + virDomainControllerDefPtr cont = NULL;
This variable isn't necessary.
> + /* Let's make sure the disk has a controller defined and
loaded before
> + * trying to add it. The controller used by the disk must exist before a
> + * qemu command line string is generated.
> + *
> + * Ensure that the given controller and all controllers with a smaller index
> + * exist; there must not be any missing index in between.
> + */
> + for (i = 0; i <= disk->info.addr.drive.controller; i++) {
> + cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i);
> + if (!cont)
> + goto error;
This can be checked right away as the value of 'cont' isn't used.
> + /* Tell clang that "cont" is non-NULL.
> + This is because disk->info.addr.driver.controller is unsigned,
> + and hence the above loop must iterate at least once. */
> + sa_assert(cont);
Also this whole comment and assert can be dropped.
You're right.
I'll adjust the patch and push it shortly. Thanks for fixing up
the mess
I've made.
Okay, thanks.
Regards,
Marc