All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Julien Grall <julien@xen.org>
Cc: xen-devel@lists.xenproject.org, bertrand.marquis@arm.com,
	 Rahul.Singh@arm.com, Julien Grall <jgrall@amazon.com>,
	 Stefano Stabellini <sstabellini@kernel.org>,
	 Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH] xen/serial: scif: Rework how the parameters are found
Date: Mon, 4 Jan 2021 09:47:12 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2101040947030.3465@sstabellini-ThinkPad-T480s> (raw)
In-Reply-To: <20201224165021.449-1-julien@xen.org>

On Thu, 24 Dec 2020, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> clang 11 will throw the following error while build Xen:
> 
> scif-uart.c:333:33: error: cast to smaller integer type 'enum port_types' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>     uart->params = &port_params[(enum port_types)match->data];
>                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> The error can be prevented by directly storing a pointer to the port
> parameters rather than the a cast of the port type.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 
> Only build tested as I don't have the HW.
> ---
>  xen/drivers/char/scif-uart.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c
> index 9d3f66b55b67..ee204a11a471 100644
> --- a/xen/drivers/char/scif-uart.c
> +++ b/xen/drivers/char/scif-uart.c
> @@ -286,8 +286,8 @@ static struct uart_driver __read_mostly scif_uart_driver = {
>  
>  static const struct dt_device_match scif_uart_dt_match[] __initconst =
>  {
> -    { .compatible = "renesas,scif",  .data = (void *)SCIF_PORT },
> -    { .compatible = "renesas,scifa", .data = (void *)SCIFA_PORT },
> +    { .compatible = "renesas,scif",  .data = &port_params[SCIF_PORT] },
> +    { .compatible = "renesas,scifa", .data = &port_params[SCIFA_PORT] },
>      { /* sentinel */ },
>  };
>  
> @@ -330,7 +330,7 @@ static int __init scif_uart_init(struct dt_device_node *dev,
>  
>      match = dt_match_node(scif_uart_dt_match, dev);
>      ASSERT( match );
> -    uart->params = &port_params[(enum port_types)match->data];
> +    uart->params = match->data;
>  
>      uart->vuart.base_addr  = addr;
>      uart->vuart.size       = size;
> -- 
> 2.17.1
> 


      parent reply	other threads:[~2021-01-04 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 16:50 [PATCH] xen/serial: scif: Rework how the parameters are found Julien Grall
2020-12-24 19:57 ` Oleksandr
2021-01-04 17:47 ` Stefano Stabellini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2101040947030.3465@sstabellini-ThinkPad-T480s \
    --to=sstabellini@kernel.org \
    --cc=Rahul.Singh@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jgrall@amazon.com \
    --cc=julien@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.