All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jens Axboe <axboe@kernel.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 8/9] pktcdvd: Get rid of redundant 'else'
Date: Fri, 20 Jan 2023 00:08:08 +0200	[thread overview]
Message-ID: <20230119220809.5518-8-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230119220809.5518-1-andriy.shevchenko@linux.intel.com>

In the snippets like the following

	if (...)
		return / goto / break / continue ...;
	else
		...

the 'else' is redundant. Get rid of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/block/pktcdvd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 340e953e3888..22048739a245 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -958,25 +958,25 @@ static int pkt_set_segment_merging(struct pktcdvd_device *pd, struct request_que
 {
 	struct device *ddev = disk_to_dev(pd->disk);
 
-	if ((pd->settings.size << 9) / CD_FRAMESIZE
-	    <= queue_max_segments(q)) {
+	if ((pd->settings.size << 9) / CD_FRAMESIZE <= queue_max_segments(q)) {
 		/*
 		 * The cdrom device can handle one segment/frame
 		 */
 		clear_bit(PACKET_MERGE_SEGS, &pd->flags);
 		return 0;
-	} else if ((pd->settings.size << 9) / PAGE_SIZE
-		   <= queue_max_segments(q)) {
+	}
+
+	if ((pd->settings.size << 9) / PAGE_SIZE <= queue_max_segments(q)) {
 		/*
 		 * We can handle this case at the expense of some extra memory
 		 * copies during write operations
 		 */
 		set_bit(PACKET_MERGE_SEGS, &pd->flags);
 		return 0;
-	} else {
-		dev_err(ddev, "cdrom max_phys_segments too small\n");
-		return -EIO;
 	}
+
+	dev_err(ddev, "cdrom max_phys_segments too small\n");
+	return -EIO;
 }
 
 static void pkt_end_io_read(struct bio *bio)
-- 
2.39.0


  parent reply	other threads:[~2023-01-19 22:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 22:08 [PATCH v1 1/9] pktcdvd: Get rid of custom printing macros Andy Shevchenko
2023-01-19 22:08 ` [PATCH v1 2/9] pktcdvd: replace sscanf() by kstrtoul() Andy Shevchenko
2023-01-19 22:40   ` David Laight
2023-01-20 11:47     ` 'Andy Shevchenko'
2023-01-19 22:08 ` [PATCH v1 3/9] pktcdvd: use sysfs_emit() to instead of scnprintf() Andy Shevchenko
2023-01-20  7:27   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 4/9] pktcdvd: Get rid of pkt_seq_show() forward declaration Andy Shevchenko
2023-01-20  7:27   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 5/9] pktcdvd: Drop redundant castings for sector_t Andy Shevchenko
2023-01-20  7:28   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 6/9] pktcdvd: Use DEFINE_SHOW_ATTRIBUTE() to simplify code Andy Shevchenko
2023-01-20  7:26   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 7/9] pktcdvd: Use put_unaligned_be16() and get_unaligned_be16() Andy Shevchenko
2023-01-19 22:08 ` Andy Shevchenko [this message]
2023-01-20  7:26   ` [PATCH v1 8/9] pktcdvd: Get rid of redundant 'else' Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 9/9] pktcdvd: Sort headers Andy Shevchenko
2023-01-20  7:28   ` Greg Kroah-Hartman
2023-01-20  7:24 ` [PATCH v1 1/9] pktcdvd: Get rid of custom printing macros Greg Kroah-Hartman

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=20230119220809.5518-8-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.