[PATCH 1/3] qemu: Drop needless check in virDomainFSInfoFormat()

Michal Privoznik posted 3 patches 4 years, 11 months ago
[PATCH 1/3] qemu: Drop needless check in virDomainFSInfoFormat()
Posted by Michal Privoznik 4 years, 11 months ago
As the very first thing, this function checks whether the number
of items inside @agentinfo array is not negative. This is
redundant as the only caller - qemuDomainGetFSInfo() already
checked for that and would not even call this function if that
was the case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_driver.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3d54653217..f59f9e13ba 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18966,8 +18966,6 @@ virDomainFSInfoFormat(qemuAgentFSInfoPtr *agentinfo,
     virDomainFSInfoPtr *info_ret = NULL;
     size_t i;
 
-    if (nagentinfo < 0)
-        return ret;
     info_ret = g_new0(virDomainFSInfoPtr, nagentinfo);
 
     for (i = 0; i < nagentinfo; i++) {
-- 
2.26.2

Re: [PATCH 1/3] qemu: Drop needless check in virDomainFSInfoFormat()
Posted by Ján Tomko 4 years, 11 months ago
On a Monday in 2021, Michal Privoznik wrote:
>As the very first thing, this function checks whether the number
>of items inside @agentinfo array is not negative. This is
>redundant as the only caller - qemuDomainGetFSInfo() already
>checked for that and would not even call this function if that
>was the case.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_driver.c | 2 --
> 1 file changed, 2 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano