Skip to contentSkip to conversation

staging: comedi: fix potentially uninitialised variable

PATCH In review Michal Nazarewicz 3 participants 3 messages Nov 10, 2013 – Nov 11, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: comedi: fix potentially uninitialised variable

From: Michal Nazarewicz <[email protected]>

If none of the if conditions take a true path, the ret variable will never be assigned a value.

---
 drivers/staging/comedi/drivers/vmk80xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/vmk80xx.c +1 -1
index 933b01a..0adf3cf 100644
@@ -465,7 +465,7 @@ static int vmk80xx_do_insn_bits(struct comedi_device *dev,
 	unsigned char *rx_buf = devpriv->usb_rx_buf;
 	unsigned char *tx_buf = devpriv->usb_tx_buf;
 	int reg, cmd;
-	int ret;
+	int ret = 0;
 
 	if (devpriv->model == VMK8061_MODEL) {
 		reg = VMK8061_DO_REG;

--
1.8.3.2

#1 lore raw
Quoted 4 lines · Michal Nazarewicz

From: Michal Nazarewicz <[email protected]>

If none of the if conditions take a true path, the ret variable will never be assigned a value.

Don't use a From: unless you are sending it on behalf of another sender.

You need a Signed-off-by line and it has to match your email address which you used to send the email.

Otherwise, the patch is good an fixes an important bug.

regards,
dan carpenter

#2 lore raw

PATCH v2 1/1 staging: comedi: fix potentially uninitialised variable

If none of the if conditions take a true path, the ret variable will never be assigned a value.

---
 drivers/staging/comedi/drivers/vmk80xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines · Dan Carpenter

Don't use a From: unless you are sending it on behalf of another sender.

You need a Signed-off-by line and it has to match your email address which you used to send the email.

Sorry about that, forgot about “-s”.

Quoted 1 line

Otherwise, the patch is good an fixes an important bug.

drivers/staging/comedi/drivers/vmk80xx.c +1 -1
index 933b01a..0adf3cf 100644
@@ -465,7 +465,7 @@ static int vmk80xx_do_insn_bits(struct comedi_device *dev,
 	unsigned char *rx_buf = devpriv->usb_rx_buf;
 	unsigned char *tx_buf = devpriv->usb_tx_buf;
 	int reg, cmd;
-	int ret;
+	int ret = 0;
 
 	if (devpriv->model == VMK8061_MODEL) {
 		reg = VMK8061_DO_REG;
Signature · 1 line
1.8.3.2