From: Suraj Sumangala <suraj@atheros.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: <Jothikumar.Mothilal@Atheros.com>, Suraj Sumangala <suraj@atheros.com>
Subject: [PATCH] hciattach: makes set_speed return error if any one operation fail
Date: Tue, 23 Nov 2010 16:09:43 +0530 [thread overview]
Message-ID: <1290508783-31183-1-git-send-email-suraj@atheros.com> (raw)
This patch lets set_speed function changing UART baud rate
to return an error code if any one operation fails
instead of returning only the last operation's status.
---
tools/hciattach.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index fd53710..7cb8e9e 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -144,9 +144,16 @@ static int uart_speed(int s)
int set_speed(int fd, struct termios *ti, int speed)
{
- cfsetospeed(ti, uart_speed(speed));
- cfsetispeed(ti, uart_speed(speed));
- return tcsetattr(fd, TCSANOW, ti);
+ if (cfsetospeed(ti, uart_speed(speed)) < 0)
+ return -errno;
+
+ if (cfsetispeed(ti, uart_speed(speed)) < 0)
+ return -errno;
+
+ if (tcsetattr(fd, TCSANOW, ti) < 0)
+ return -errno;
+
+ return 0;
}
/*
--
1.7.0.4
next reply other threads:[~2010-11-23 10:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 10:39 Suraj Sumangala [this message]
2010-11-23 11:10 ` [PATCH] hciattach: makes set_speed return error if any one operation fail Johan Hedberg
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=1290508783-31183-1-git-send-email-suraj@atheros.com \
--to=suraj@atheros.com \
--cc=Jothikumar.Mothilal@Atheros.com \
--cc=linux-bluetooth@vger.kernel.org \
/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