Re: [PATCH] virtio_balloon: Fix unused label warning

From: Nathan Chancellor
Date: Sun Feb 16 2020 - 02:47:23 EST


On Mon, Feb 10, 2020 at 10:33:28AM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Fix
>
> drivers/virtio/virtio_balloon.c: In function âvirtballoon_probeâ:
> drivers/virtio/virtio_balloon.c:963:1: warning: label âout_del_vqsâ defined but not used [-Wunused-label]
> 963 | out_del_vqs:
> | ^~
>
> The CONFIG_BALLOON_COMPACTION ifdeffery should enclose it too.
>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> ---
> drivers/virtio/virtio_balloon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 7bfe365d9372..b6ed5f8bccb1 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -959,9 +959,9 @@ static int virtballoon_probe(struct virtio_device *vdev)
> iput(vb->vb_dev_info.inode);
> out_kern_unmount:
> kern_unmount(balloon_mnt);
> -#endif
> out_del_vqs:
> vdev->config->del_vqs(vdev);
> +#endif

I noticed the same issue and sent an almost identical patch [1] but I
kept the call to del_vqs outside of the CONFIG_BALLOON_COMPACTION guard
since it seems like that should still be called when that config is
unset, as that was the case before commit 1ad6f58ea936 ("virtio_balloon:
Fix memory leaks on errors in virtballoon_probe()"). Is this patch fully
correct? I am not a virtio expert at all, just noticing from a brief
reading of this function.

[1]: https://lore.kernel.org/lkml/20200216004039.23464-1-natechancellor@xxxxxxxxx/

Cheers,
Nathan

> out_free_vb:
> kfree(vb);
> out:
> --
> 2.21.0
>