Archive-only list for patches
 help / color / mirror / Atom feed
* [PATCH] media: dvbdev: Avoid using uninitialized ret in dvb_register_device()
@ 2024-10-21 16:04 Nathan Chancellor
  2024-10-22 14:45 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2024-10-21 16:04 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, llvm, patches, kernel test robot,
	Dan Carpenter, Nathan Chancellor

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410201717.ULWWdJv8-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 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@kernel.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-22 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 16:04 [PATCH] media: dvbdev: Avoid using uninitialized ret in dvb_register_device() Nathan Chancellor
2024-10-22 14:45 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox