From: Namhyung Kim <namhyung@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jens Axboe <axboe@kernel.dk>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] bsg: remove unnecessary conditional expressions
Date: Sun, 15 May 2011 14:31:52 +0900 [thread overview]
Message-ID: <1305437513-3914-2-git-send-email-namhyung@gmail.com> (raw)
In-Reply-To: <1305437513-3914-1-git-send-email-namhyung@gmail.com>
Second condition in OR always implies first condition is false
thus bytes_read in the second is not needed. The same goes to
bytes_written.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
block/bsg.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/bsg.c b/block/bsg.c
index c4f49e255751..b7e42ad55361 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -606,7 +606,7 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
ret = __bsg_read(buf, count, bd, NULL, &bytes_read);
*ppos = bytes_read;
- if (!bytes_read || (bytes_read && err_block_err(ret)))
+ if (!bytes_read || err_block_err(ret))
bytes_read = ret;
return bytes_read;
@@ -686,7 +686,7 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
/*
* return bytes written on non-fatal errors
*/
- if (!bytes_written || (bytes_written && err_block_err(ret)))
+ if (!bytes_written || err_block_err(ret))
bytes_written = ret;
dprintk("%s: returning %Zd\n", bd->name, bytes_written);
--
1.7.5
next prev parent reply other threads:[~2011-05-15 5:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-15 5:31 [PATCH 1/3] bsg: fix bsg_poll() to return POLLOUT properly Namhyung Kim
2011-05-15 5:31 ` Namhyung Kim [this message]
2011-05-15 5:31 ` [PATCH 3/3] bsg: fix address space warning from sparse Namhyung Kim
[not found] ` <20110519.030933.1568838937885764850.fujita.tomonori@lab.ntt.co.jp@lab.ntt.co.jp>
2011-05-18 19:30 ` [PATCH 1/3] bsg: fix bsg_poll() to return POLLOUT properly Jens Axboe
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=1305437513-3914-2-git-send-email-namhyung@gmail.com \
--to=namhyung@gmail.com \
--cc=axboe@kernel.dk \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).