linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation
@ 2019-04-29  6:05 Nicholas Mc Guire
  2019-04-29  6:05 ` [PATCH V3] staging: fieldbus: anybus-s: consolidate wait_for_completion_timeout return handling Nicholas Mc Guire
  2019-04-29 14:03 ` [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation Sven Van Asbroeck
  0 siblings, 2 replies; 13+ messages in thread
From: Nicholas Mc Guire @ 2019-04-29  6:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Sven Van Asbroeck, devel, linux-kernel, Nicholas Mc Guire

While the endiannes is being handled correctly sparse was unhappy with
the missing annotation as be16_to_cpu() expects a __be16. The __force
cast to __be16 makes sparse happy but has no impact on the generated 
binary.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Problem reported by sparse

V2: As requested by Sven Van Asbroeck <thesven73@gmail.com> make the
    impact of the patch clear in the commit message.

As far as I understand sparse here the __force is actually the only 
solution possible to inform sparse that the endiannes handling is ok

Patch was compile-tested with. x86_64_defconfig + OF=y, FIELDBUS_DEV=m,
HMS_ANYBUSS_BUS=m

Verification that the patch has no impact on the binary being generated
was done by verifying that the diff of the binaries before and after
applying the patch is empty.


Patch is against 5.1-rc6 (localversion-next is next-20190426)

 drivers/staging/fieldbus/anybuss/host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c
index 6227daf..278acac 100644
--- a/drivers/staging/fieldbus/anybuss/host.c
+++ b/drivers/staging/fieldbus/anybuss/host.c
@@ -1348,7 +1348,7 @@ anybuss_host_common_probe(struct device *dev,
 	add_device_randomness(&val, 4);
 	regmap_bulk_read(cd->regmap, REG_FIELDBUS_TYPE, &fieldbus_type,
 			 sizeof(fieldbus_type));
-	fieldbus_type = be16_to_cpu(fieldbus_type);
+	fieldbus_type = be16_to_cpu((__force __be16)fieldbus_type);
 	dev_info(dev, "Fieldbus type: %04X", fieldbus_type);
 	regmap_bulk_read(cd->regmap, REG_MODULE_SW_V, val, 2);
 	dev_info(dev, "Module SW version: %02X%02X",
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-04-30 14:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29  6:05 [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation Nicholas Mc Guire
2019-04-29  6:05 ` [PATCH V3] staging: fieldbus: anybus-s: consolidate wait_for_completion_timeout return handling Nicholas Mc Guire
2019-04-29 14:01   ` Sven Van Asbroeck
2019-04-29 14:03 ` [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation Sven Van Asbroeck
2019-04-30  2:22   ` Nicholas Mc Guire
2019-04-30  3:02     ` Al Viro
2019-04-30  3:33       ` Nicholas Mc Guire
2019-04-30  4:19         ` Al Viro
2019-04-30 13:32           ` Sven Van Asbroeck
2019-04-30 14:03             ` Greg Kroah-Hartman
2019-04-30 14:22               ` Sven Van Asbroeck
2019-04-30 14:26                 ` Sven Van Asbroeck
2019-04-30 14:27             ` Al Viro

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).