All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hugo Villeneuve <hugo@hugovil.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	cosmin.tanislav@analog.com, andy.shevchenko@gmail.com,
	shc_work@mail.ru
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	hugo@hugovil.com, Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: [PATCH v2 10/17] serial: max310x: add explicit return for some switch default cases
Date: Thu, 18 Jan 2024 10:22:06 -0500	[thread overview]
Message-ID: <20240118152213.2644269-11-hugo@hugovil.com> (raw)
In-Reply-To: <20240118152213.2644269-1-hugo@hugovil.com>

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

Allows to simplify code by removing the break statement in the default
switch/case in some functions.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 drivers/tty/serial/max310x.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 9ef146f09d5b..048ae432ba48 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -483,10 +483,8 @@ static bool max310x_reg_writeable(struct device *dev, unsigned int reg)
 	case MAX310X_RXFIFOLVL_REG:
 		return false;
 	default:
-		break;
+		return true;
 	}
-
-	return true;
 }
 
 static bool max310x_reg_volatile(struct device *dev, unsigned int reg)
@@ -505,10 +503,8 @@ static bool max310x_reg_volatile(struct device *dev, unsigned int reg)
 	case MAX310X_REG_1F:
 		return true;
 	default:
-		break;
+		return false;
 	}
-
-	return false;
 }
 
 static bool max310x_reg_precious(struct device *dev, unsigned int reg)
@@ -520,10 +516,8 @@ static bool max310x_reg_precious(struct device *dev, unsigned int reg)
 	case MAX310X_STS_IRQSTS_REG:
 		return true;
 	default:
-		break;
+		return false;
 	}
-
-	return false;
 }
 
 static bool max310x_reg_noinc(struct device *dev, unsigned int reg)
-- 
2.39.2


  parent reply	other threads:[~2024-01-18 15:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 15:21 [PATCH v2 00/17] serial: max310x: cleanups and improvements Hugo Villeneuve
2024-01-18 15:21 ` [PATCH v2 01/17] serial: max310x: fix NULL pointer dereference in I2C instantiation Hugo Villeneuve
2024-01-18 15:21 ` [PATCH v2 02/17] serial: max310x: add I2C device table for instantiation from userspace Hugo Villeneuve
2024-01-18 15:21 ` [PATCH v2 03/17] serial: max310x: use i2c_get_match_data() Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 04/17] serial: max310x: use spi_get_device_match_data() Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 05/17] serial: max310x: fix syntax error in IRQ error message Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 06/17] serial: max310x: remove holes in struct max310x_devtype Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 07/17] serial: max310x: add macro for max number of ports Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 08/17] serial: max310x: use separate regmap name for each port Hugo Villeneuve
2024-01-18 15:30   ` Andy Shevchenko
2024-01-18 15:44     ` Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 09/17] serial: max310x: simplify probe() and remove() error handling Hugo Villeneuve
2024-01-18 15:22 ` Hugo Villeneuve [this message]
2024-01-18 15:22 ` [PATCH v2 11/17] serial: max310x: use dev_err_probe() instead of dev_err() Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 12/17] serial: max310x: replace hardcoded masks with preferred GENMASK() Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 13/17] serial: max310x: use common detect function for all variants Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 14/17] serial: max310x: use common power " Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 15/17] serial: max310x: replace bare use of 'unsigned' with 'unsigned int' (checkpatch) Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 16/17] serial: max310x: reformat and improve comments Hugo Villeneuve
2024-01-18 15:22 ` [PATCH v2 17/17] serial: max310x: fix indentation Hugo Villeneuve

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=20240118152213.2644269-11-hugo@hugovil.com \
    --to=hugo@hugovil.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shc_work@mail.ru \
    /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.