Commit a09af055 authored by Justin Stitt's avatar Justin Stitt Committed by Lee Jones

leds: pca955x: Fix -Wvoid-pointer-to-enum-cast warning

When building with clang 18 I see the following warning:
|      drivers/leds/leds-pca955x.c:487:15: warning: cast to smaller integer
|      type 'enum pca955x_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
|        487 |                 chip_type = (enum pca955x_type)md;

This is due to the fact that `md` is a void* while `enum pca995x_type` has the
size of an int.

Add uintptr_t cast to silence clang warning while also keeping enum cast
for readability and consistency with other `chip_type` assignment just a
few lines below:
|	chip_type = (enum pca955x_type)id->driver_data;
Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
Closes: https://github.com/ClangBuiltLinux/linux/issues/1910Signed-off-by: default avatarJustin Stitt <justinstitt@google.com>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20230816-void-drivers-leds-leds-pca955x-v1-1-2967e4c1bdcc@google.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 0bb80ecc
...@@ -484,7 +484,7 @@ static int pca955x_probe(struct i2c_client *client) ...@@ -484,7 +484,7 @@ static int pca955x_probe(struct i2c_client *client)
const void *md = device_get_match_data(&client->dev); const void *md = device_get_match_data(&client->dev);
if (md) { if (md) {
chip_type = (enum pca955x_type)md; chip_type = (enum pca955x_type)(uintptr_t)md;
} else { } else {
const struct i2c_device_id *id = i2c_match_id(pca955x_id, const struct i2c_device_id *id = i2c_match_id(pca955x_id,
client); client);
......
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