Commit 866f7021 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

regmap: kunit: Fix warnings of implicit casts to __le16 and __be16

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: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240408144600.230848-2-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 70ee853e
...@@ -1115,9 +1115,9 @@ static void raw_read_defaults(struct kunit *test) ...@@ -1115,9 +1115,9 @@ static void raw_read_defaults(struct kunit *test)
for (i = 0; i < config.max_register + 1; i++) { for (i = 0; i < config.max_register + 1; i++) {
def = config.reg_defaults[i].def; def = config.reg_defaults[i].def;
if (config.val_format_endian == REGMAP_ENDIAN_BIG) { 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 { } else {
KUNIT_EXPECT_EQ(test, def, le16_to_cpu(rval[i])); KUNIT_EXPECT_EQ(test, def, le16_to_cpu((__force __le16)rval[i]));
} }
} }
...@@ -1185,10 +1185,10 @@ static void raw_write(struct kunit *test) ...@@ -1185,10 +1185,10 @@ static void raw_write(struct kunit *test)
case 3: case 3:
if (config.val_format_endian == REGMAP_ENDIAN_BIG) { if (config.val_format_endian == REGMAP_ENDIAN_BIG) {
KUNIT_EXPECT_EQ(test, rval, KUNIT_EXPECT_EQ(test, rval,
be16_to_cpu(val[i % 2])); be16_to_cpu((__force __be16)val[i % 2]));
} else { } else {
KUNIT_EXPECT_EQ(test, rval, KUNIT_EXPECT_EQ(test, rval,
le16_to_cpu(val[i % 2])); le16_to_cpu((__force __le16)val[i % 2]));
} }
break; break;
default: default:
...@@ -1300,10 +1300,10 @@ static void raw_sync(struct kunit *test) ...@@ -1300,10 +1300,10 @@ static void raw_sync(struct kunit *test)
case 3: case 3:
if (config.val_format_endian == REGMAP_ENDIAN_BIG) { if (config.val_format_endian == REGMAP_ENDIAN_BIG) {
KUNIT_EXPECT_EQ(test, rval, KUNIT_EXPECT_EQ(test, rval,
be16_to_cpu(val[i - 2])); be16_to_cpu((__force __be16)val[i - 2]));
} else { } else {
KUNIT_EXPECT_EQ(test, rval, KUNIT_EXPECT_EQ(test, rval,
le16_to_cpu(val[i - 2])); le16_to_cpu((__force __le16)val[i - 2]));
} }
break; break;
case 4: case 4:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment