[PATCH] media: dvbdev: Avoid using uninitialized ret in dvb_register_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When CONFIG_DVB_DYNAMIC_MINORS is not enabled, clang warns (or errors
with CONFIG_WERROR=y):

  drivers/media/dvb-core/dvbdev.c:554:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
    554 |                 return ret;
        |                        ^~~

Use the return code -EINVAL directly, like the CONFIG_DVB_DYNAMIC_MINORS
block does.

Fixes: 972e63e895ab ("media: dvbdev: prevent the risk of out of memory access")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Closes: https://lore.kernel.org/r/202410201717.ULWWdJv8-lkp@xxxxxxxxx/
Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
---
 drivers/media/dvb-core/dvbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 14f323fbada719f717fb7fe9f6f2a3ce81e609a3..5bb36be911f615afa1f3a7a13f974b67b3216edd 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -551,7 +551,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
 		kfree(dvbdev);
 		*pdvbdev = NULL;
 		mutex_unlock(&dvbdev_register_lock);
-		return ret;
+		return -EINVAL;
 	}
 #endif
 	dvbdev->minor = minor;

---
base-commit: ba9cf6b430433e57bfc8072364e944b7c0eca2a4
change-id: 20241021-dvbdev-fix-uninitialized-return-6ef4187dfafa

Best regards,
-- 
Nathan Chancellor <nathan@xxxxxxxxxx>





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux