can-next: fix clang warnings
Marc Kleine-Budde
maintainerHello,
This series fixes two warnings found by clang, the first one was reported by intel's kernel test robot.
Marc
Marc Kleine-Budde
maintainerPATCH 1/2 can: mcp251x: mcp251x_can_probe(): silence clang warning
This patch silences the following clang warning:
| drivers/net/can/spi/mcp251x.c:1333:17: warning: cast to smaller integer type | 'enum mcp251x_model' from 'const void *' [-Wvoid-pointer-to-enum-cast] | priv->model = (enum mcp251x_model)match; | ^~~~~~~~~~~~~~~~~~~~~~~~~
--- drivers/net/can/spi/mcp251x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251x.c +1 -1
@@ -1343,7 +1343,7 @@ static int mcp251x_can_probe(struct spi_device *spi) priv->can.ctrlmode_supported =CAN_CTRLMODE_3_SAMPLES |CAN_CTRLMODE_LOOPBACK |CAN_CTRLMODE_LISTENONLY ;if (match) - priv->model = (enum mcp251x_model )match; + priv->model = (enum mcp251x_model )(kernel_ulong_t )match;else priv->model =spi_get_device_id (spi)->driver_data; priv->net = net;
base-commit: 9d31d2338950293ec19d9b095fbaa9030899dcb4
prerequisite-patch-id: 2d99a92f9c04a76341ba84b5f4924c2ba03bdd88
prerequisite-patch-id: 6dbb40c8b889604bf57aa2374f34290b247b7d28
prerequisite-patch-id: 24ff9c746552e4a8e100200f13bb1732990392a3
Signature · 1 line
2.30.2
Re: [can-nextc 1/2] can: mcp251x: mcp251x_can_probe(): silence clang warning
Quoted 20 lines · Marc Kleine-Budde
This patch silences the following clang warning:
| drivers/net/can/spi/mcp251x.c:1333:17: warning: cast to smaller integer type | 'enum mcp251x_model' from 'const void *' [-Wvoid-pointer-to-enum-cast] | priv->model = (enum mcp251x_model)match; | ^~~~~~~~~~~~~~~~~~~~~~~~~Fixes 8de29a5c34a5 ("can: mcp251x: Make use of device property API")Reported-by kernel test robot <[email protected]>Cc Andy Shevchenko <[email protected]>Signed-off-by Marc Kleine-Budde <[email protected]>--- drivers/net/can/spi/mcp251x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/can/spi/mcp251x.c +0
-0
drivers/net/can/spi/mcp251x.c static int mcp251x_can_probe(struct spi_device *spi) · line 1346
Quoted 5 lines
drivers/net/can/spi/mcp251x.c +1
-1@@ -1343,7 +1343,7 @@ static int mcp251x_can_probe(struct spi_device *spi) priv->can.ctrlmode_supported =CAN_CTRLMODE_3_SAMPLES |CAN_CTRLMODE_LOOPBACK |CAN_CTRLMODE_LISTENONLY ;if (match) - priv->model = (enum mcp251x_model )match; + priv->model = (enum mcp251x_model )(kernel_ulong_t )match;
Usually we use uintptr_t, but either way
Thanks!
Quoted 12 lines
drivers/net/can/spi/mcp251x.c +0
-0else priv->model =spi_get_device_id (spi)->driver_data; priv->net = net;base-commit:
9d31d2338950293ec19d9b095fbaa9030899dcb4
prerequisite-patch-id:2d99a92f9c04a76341ba84b5f4924c2ba03bdd88
prerequisite-patch-id:6dbb40c8b889604bf57aa2374f34290b247b7d28
prerequisite-patch-id:24ff9c746552e4a8e100200f13bb1732990392a3Signature · 1 line
2.30.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Marc Kleine-Budde
maintainerRe: [can-nextc 1/2] can: mcp251x: mcp251x_can_probe(): silence clang warning
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Marc Kleine-Budde
This patch silences the following clang warning:
| drivers/net/can/spi/mcp251x.c:1333:17: warning: cast to smaller integer type | 'enum mcp251x_model' from 'const void *' [-Wvoid-pointer-to-enum-cast] | priv->model = (enum mcp251x_model)match; | ^~~~~~~~~~~~~~~~~~~~~~~~~Fixes 8de29a5c34a5 ("can: mcp251x: Make use of device property API")Reported-by kernel test robot <[email protected]>Cc Andy Shevchenko <[email protected]>Signed-off-by Marc Kleine-Budde <[email protected]>--- drivers/net/can/spi/mcp251x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
drivers/net/can/spi/mcp251x.c static int mcp251x_can_probe(struct spi_device *spi) · line 1346
Quoted 10 lines
drivers/net/can/spi/mcp251x.c +1
-1@@ -1343,7 +1343,7 @@ static int mcp251x_can_probe(struct spi_device *spi) priv->can.ctrlmode_supported =CAN_CTRLMODE_3_SAMPLES |CAN_CTRLMODE_LOOPBACK |CAN_CTRLMODE_LISTENONLY ;if (match) - priv->model = (enum mcp251x_model )match; + priv->model = (enum mcp251x_model )(kernel_ulong_t )match;Usually we use
uintptr_t, but either way
I've updated the patch to uintptr_t.
Quoted 1 line
Reviewed-by Andy Shevchenko <[email protected]>
Thanks,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Marc Kleine-Budde
maintainerPATCH 2/2 can: hi311x: hi3110_can_probe(): silence clang warning
In reply to Marc Kleine-BuddeThis patch silences the following clang warning:
| drivers/net/can/spi/hi311x.c:874:17: warning: cast to smaller integer type | 'enum hi3110_model' from 'const void *' [-Wvoid-pointer-to-enum-cast] | priv->model = (enum hi3110_model)of_id->data; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- drivers/net/can/spi/hi311x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/hi311x.c +1 -1
@@ -871,7 +871,7 @@ static int hi3110_can_probe(struct spi_device *spi)CAN_CTRLMODE_BERR_REPORTING ;if (of_id) - priv->model = (enum hi3110_model )of_id->data; + priv->model = (enum hi3110_model )(kernel_ulong_t )of_id->data;else priv->model =spi_get_device_id (spi)->driver_data; priv->net = net;
Signature · 1 line
2.30.2