[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210514140556.3492544-1-arnd@kernel.org>
Date: Fri, 14 May 2021 16:05:46 +0200
From: Arnd Bergmann <arnd@...nel.org>
To: Maximilian Luz <luzmaximilian@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Hans de Goede <hdegoede@...hat.com>
Cc: Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com
Subject: [PATCH] platform/surface: aggregator: shut up clang -Wconstantn-conversion warning
From: Arnd Bergmann <arnd@...db.de>
Clang complains about the assignment of SSAM_ANY_IID to
ssam_device_uid->instance:
drivers/platform/surface/surface_aggregator_registry.c:478:25: error: implicit conversion from 'int' to '__u8' (aka 'unsigned char') changes value from 65535 to 255 [-Werror,-Wconstant-conversion]
{ SSAM_VDEV(HUB, 0x02, SSAM_ANY_IID, 0x00) },
~ ^~~~~~~~~~~~
include/linux/surface_aggregator/device.h:71:23: note: expanded from macro 'SSAM_ANY_IID'
#define SSAM_ANY_IID 0xffff
^~~~~~
include/linux/surface_aggregator/device.h:126:63: note: expanded from macro 'SSAM_VDEV'
SSAM_DEVICE(SSAM_DOMAIN_VIRTUAL, SSAM_VIRTUAL_TC_##cat, tid, iid, fun)
^~~
include/linux/surface_aggregator/device.h:102:41: note: expanded from macro 'SSAM_DEVICE'
.instance = ((iid) != SSAM_ANY_IID) ? (iid) : 0, \
^~~
The assignment doesn't actually happen, but clang checks the type limits
before checking whether this assignment is reached. Shut up the warning
using an explicit type cast.
Fixes: eb0e90a82098 ("platform/surface: aggregator: Add dedicated bus and device type")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
include/linux/surface_aggregator/device.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h
index 4441ad667c3f..90df092ed565 100644
--- a/include/linux/surface_aggregator/device.h
+++ b/include/linux/surface_aggregator/device.h
@@ -98,9 +98,9 @@ struct ssam_device_uid {
| (((fun) != SSAM_ANY_FUN) ? SSAM_MATCH_FUNCTION : 0), \
.domain = d, \
.category = cat, \
- .target = ((tid) != SSAM_ANY_TID) ? (tid) : 0, \
- .instance = ((iid) != SSAM_ANY_IID) ? (iid) : 0, \
- .function = ((fun) != SSAM_ANY_FUN) ? (fun) : 0 \
+ .target = ((tid) != SSAM_ANY_TID) ? (u8)(tid) : 0, \
+ .instance = ((iid) != SSAM_ANY_IID) ? (u8)(iid) : 0, \
+ .function = ((fun) != SSAM_ANY_FUN) ? (u8)(fun) : 0 \
/**
* SSAM_VDEV() - Initialize a &struct ssam_device_id as virtual device with
--
2.29.2
Powered by blists - more mailing lists