mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: comedi: fix potentially uninitialised variable
@ 2013-11-10 18:37 Michal Nazarewicz
  2013-11-10 21:28 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Nazarewicz @ 2013-11-10 18:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, H Hartley Sweeten, Ian Abbott; +Cc: devel, linux-kernel

From: Michal Nazarewicz <mina86@mina86.com>

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(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index 933b01a..0adf3cf 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -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

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

* Re: [PATCH] staging: comedi: fix potentially uninitialised variable
  2013-11-10 18:37 [PATCH] staging: comedi: fix potentially uninitialised variable Michal Nazarewicz
@ 2013-11-10 21:28 ` Dan Carpenter
  2013-11-11 11:31   ` [PATCHv2] " Michal Nazarewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-11-10 21:28 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Greg Kroah-Hartman, H Hartley Sweeten, Ian Abbott, devel, linux-kernel

On Sun, Nov 10, 2013 at 07:37:49PM +0100, Michal Nazarewicz wrote:
> From: Michal Nazarewicz <mina86@mina86.com>
> 
> 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

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

* [PATCHv2] staging: comedi: fix potentially uninitialised variable
  2013-11-10 21:28 ` Dan Carpenter
@ 2013-11-11 11:31   ` Michal Nazarewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Nazarewicz @ 2013-11-11 11:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, H Hartley Sweeten, Ian Abbott, devel, linux-kernel

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

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/staging/comedi/drivers/vmk80xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

On Sun, Nov 10 2013, Dan Carpenter wrote:
> 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”.

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

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index 933b01a..0adf3cf 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -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

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

end of thread, other threads:[~2013-11-11 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10 18:37 [PATCH] staging: comedi: fix potentially uninitialised variable Michal Nazarewicz
2013-11-10 21:28 ` Dan Carpenter
2013-11-11 11:31   ` [PATCHv2] " Michal Nazarewicz

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

Powered by JetHome