From: Jiri Pirko
> Sent: 04 October 2015 22:26
> Be consistent with the rest of the setting functions, and pass
> "learning" as a bool function parameter.
...
> diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
> b/drivers/net/ethernet/rocker/rocker_main.c
> index fb7e8c2..d9329a7 100644
> --- a/drivers/net/ethernet/rocker/rocker_main.c
> +++ b/drivers/net/ethernet/rocker/rocker_main.c
> @@ -1634,6 +1634,7 @@ rocker_cmd_set_port_learning_prep(const struct 
> rocker_port *rocker_port,
>                                 struct rocker_desc_info *desc_info,
>                                 void *priv)
>  {
> +     bool learning = *(int *)priv;
...
> static int rocker_port_set_learning(struct rocker_port *rocker_port,
> -                                 struct switchdev_trans *trans)
> +                                 struct switchdev_trans *trans,
> +                                 bool learning)
> {
>       return rocker_cmd_exec(rocker_port, trans, 0,
>                              rocker_cmd_set_port_learning_prep,
> -                            NULL, NULL, NULL);
> +                            &learning, NULL, NULL);

This hit my 'casting between integer pointer types' bell.
It is clearly wrong if 'sizeof (bool) != sizeof (int)'.

It is much safer to only ever cast structure types to/from 'void *'.

        David

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to