public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: jhovold@gmail.com, Jiri Slaby <jslaby@suse.cz>,
	mferrell@uplogix.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] drivers/usb/serial: looping issue: avoid the return value overriden by looping
Date: Mon, 01 Apr 2013 11:50:55 +0800	[thread overview]
Message-ID: <5159041F.7020608@asianux.com> (raw)
In-Reply-To: <20130401030555.GA21113@kroah.com>


  inside the 'for' looping:
    the return value 'rv' may override if not have a check in time.

  next checking, outside the 'for' looping:
    can not find failure which generated during the 'for' looping

  so need let outside know about the failure.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 drivers/usb/serial/mos7840.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a0d5ea5..13aae1e 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -651,7 +651,9 @@ static void mos7840_interrupt_callback(struct urb *urb)
 					wreg = MODEM_STATUS_REGISTER;
 					break;
 				}
-				rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data);
+				if (mos7840_get_reg(mos7840_port, wval,
+				    wreg, &Data) < 0)
+					rv = -1;
 			}
 		}
 	}
-- 
1.7.7.6

  parent reply	other threads:[~2013-04-01  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  2:52 [Suggestion] drivers/usb/serial: looping issue: return value may override by looping Chen Gang
2013-04-01  3:05 ` Greg KH
2013-04-01  3:21   ` Chen Gang
2013-04-01  3:50   ` Chen Gang [this message]
2013-04-01 19:37     ` USB: mos7840: looping issue: avoid the return value overriden " Greg KH
2013-04-02  1:03       ` Chen Gang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5159041F.7020608@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhovold@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mferrell@uplogix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox