Skip to contentSkip to conversation

media: dvbdev: return -EINVAL on failure

PATCH New Arnd Bergmann 1 participant 1 message Oct 28, 2024 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: dvbdev: return -EINVAL on failure

From: Arnd Bergmann <[email protected]>

The dvb_register_device() function can return an uninitialized error code:

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

Change this to -EINVAL as in the other half of the #ifdef block.

Fixes 972e63e895ab ("media: dvbdev: prevent the risk of out of memory access")
---
 drivers/media/dvb-core/dvbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-core/dvbdev.c +1 -1
index 78f46cb47c84..8c8dc7bbc59b 100644
@@ -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;
Signature · 1 line
2.39.5