mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>,
	"Richard Fitzgerald" <rf@opensource.cirrus.com>
Subject: [PATCH 01/11] regmap: kunit: Fix warnings of implicit casts to __le16 and __be16
Date: Mon, 8 Apr 2024 15:45:50 +0100	[thread overview]
Message-ID: <20240408144600.230848-2-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20240408144600.230848-1-rf@opensource.cirrus.com>

Fix warnings about implicit casts to __le16 and __be16 types reported
by smatch:

drivers/base/regmap/regmap-kunit.c:1118:25:
warning: cast to restricted __be16
drivers/base/regmap/regmap-kunit.c:1120:25:
warning: cast to restricted __le16
drivers/base/regmap/regmap-kunit.c:1187:33:
warning: cast to restricted __be16
drivers/base/regmap/regmap-kunit.c:1190:33:
warning: cast to restricted __le16
drivers/base/regmap/regmap-kunit.c:1302:33:
warning: cast to restricted __be16
drivers/base/regmap/regmap-kunit.c:1305:33:
warning: cast to restricted __le16

Perform a __force cast for all these.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 drivers/base/regmap/regmap-kunit.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c
index bb2ab6129f38..b46a4f28c1a1 100644
--- a/drivers/base/regmap/regmap-kunit.c
+++ b/drivers/base/regmap/regmap-kunit.c
@@ -1115,12 +1115,12 @@ static void raw_read_defaults(struct kunit *test)
 	for (i = 0; i < config.max_register + 1; i++) {
 		def = config.reg_defaults[i].def;
 		if (config.val_format_endian == REGMAP_ENDIAN_BIG) {
-			KUNIT_EXPECT_EQ(test, def, be16_to_cpu(rval[i]));
+			KUNIT_EXPECT_EQ(test, def, be16_to_cpu((__force __be16)rval[i]));
 		} else {
-			KUNIT_EXPECT_EQ(test, def, le16_to_cpu(rval[i]));
+			KUNIT_EXPECT_EQ(test, def, le16_to_cpu((__force __le16)rval[i]));
 		}
 	}
-	
+
 	kfree(rval);
 	regmap_exit(map);
 }
@@ -1185,10 +1185,10 @@ static void raw_write(struct kunit *test)
 		case 3:
 			if (config.val_format_endian == REGMAP_ENDIAN_BIG) {
 				KUNIT_EXPECT_EQ(test, rval,
-						be16_to_cpu(val[i % 2]));
+						be16_to_cpu((__force __be16)val[i % 2]));
 			} else {
 				KUNIT_EXPECT_EQ(test, rval,
-						le16_to_cpu(val[i % 2]));
+						le16_to_cpu((__force __le16)val[i % 2]));
 			}
 			break;
 		default:
@@ -1300,10 +1300,10 @@ static void raw_sync(struct kunit *test)
 		case 3:
 			if (config.val_format_endian == REGMAP_ENDIAN_BIG) {
 				KUNIT_EXPECT_EQ(test, rval,
-						be16_to_cpu(val[i - 2]));
+						be16_to_cpu((__force __be16)val[i - 2]));
 			} else {
 				KUNIT_EXPECT_EQ(test, rval,
-						le16_to_cpu(val[i - 2]));
+						le16_to_cpu((__force __le16)val[i - 2]));
 			}
 			break;
 		case 4:
-- 
2.39.2


  reply	other threads:[~2024-04-08 14:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 14:45 [PATCH 00/11] regmap: kunit: Add some test cases and a few small improvements Richard Fitzgerald
2024-04-08 14:45 ` Richard Fitzgerald [this message]
2024-04-08 14:45 ` [PATCH 02/11] regmap: kunit: Create a struct device for the regmap Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 03/11] regmap: kunit: Introduce struct for test case parameters Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 04/11] regmap: kunit: Run sparse cache tests at non-zero register addresses Richard Fitzgerald
2024-05-16 19:53   ` Guenter Roeck
2024-05-17 11:28     ` Mark Brown
2024-05-17 15:19       ` Guenter Roeck
2024-05-17 11:58     ` Richard Fitzgerald
2024-05-17 13:10     ` Richard Fitzgerald
2024-05-17 15:44     ` Richard Fitzgerald
2024-05-17 15:57       ` Guenter Roeck
2024-04-08 14:45 ` [PATCH 05/11] regmap: kunit: Run non-sparse " Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 06/11] regmap: kunit: Add more cache-drop tests Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 07/11] regmap: kunit: Add more cache-sync tests Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 08/11] regmap: kunit: Use a KUnit action to call regmap_exit() Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 09/11] regmap: kunit: Replace a kmalloc/kfree() pair with KUnit-managed alloc Richard Fitzgerald
2024-04-08 14:45 ` [PATCH 10/11] regmap: kunit: Add cache-drop test with multiple cache blocks Richard Fitzgerald
2024-04-08 14:46 ` [PATCH 11/11] regmap: kunit: Add test cases for regmap_read_bypassed() Richard Fitzgerald
2024-04-09 23:34 ` [PATCH 00/11] regmap: kunit: Add some test cases and a few small improvements Mark Brown

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=20240408144600.230848-2-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.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

all inboxes | Powered by JetHome®