kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] vfio/fsl-mc: fix the return of the uninitialized variable ret
@ 2020-10-16  9:32 Diana Craciun
  0 siblings, 0 replies; only message in thread
From: Diana Craciun @ 2020-10-16  9:32 UTC (permalink / raw)
  To: alex.williamson, kvm
  Cc: linux-kernel, laurentiu.tudor, colin.king, Diana Craciun

The vfio_fsl_mc_reflck_attach function may return, on success path,
an uninitialized variable. Fix the problem by initializing the return
variable to 0.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: f2ba7e8c947b ("vfio/fsl-mc: Added lock support in preparation for interrupt handling")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Diana Craciun <diana.craciun@oss.nxp.com>
---
 drivers/vfio/fsl-mc/vfio_fsl_mc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
index 80fc7f4ed343..0113a980f974 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
@@ -58,7 +58,7 @@ static struct vfio_fsl_mc_reflck *vfio_fsl_mc_reflck_alloc(void)
 
 static int vfio_fsl_mc_reflck_attach(struct vfio_fsl_mc_device *vdev)
 {
-	int ret;
+	int ret = 0;
 
 	mutex_lock(&reflck_lock);
 	if (is_fsl_mc_bus_dprc(vdev->mc_dev)) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-16  9:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16  9:32 [PATCH v2] vfio/fsl-mc: fix the return of the uninitialized variable ret Diana Craciun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).