LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] memory: renesas-rpc-if: Silence clang warning
@ 2021-11-21 18:01 Lad Prabhakar
  2021-11-22  7:50 ` Geert Uytterhoeven
  2021-11-22  9:54 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 6+ messages in thread
From: Lad Prabhakar @ 2021-11-21 18:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Nathan Chancellor, Nick Desaulniers, Wolfram Sang, Biju Das,
	linux-renesas-soc, linux-kernel, llvm, Prabhakar, Lad Prabhakar

This patch silences the following clang warning:

| drivers/memory/renesas-rpc-if.c:253:14: warning: cast to smaller integer
| type 'enum rpcif_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
|           rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
|                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: b04cc0d912eb8 ("memory: renesas-rpc-if: Add support for RZ/G2L")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 8c51145c0f5c..0202c1dbc5c4 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -250,7 +250,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
 		return PTR_ERR(rpc->dirmap);
 	rpc->size = resource_size(res);
 
-	rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
+	rpc->type = (enum rpcif_type)(uintptr_t)of_device_get_match_data(dev);
 	rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 
 	return PTR_ERR_OR_ZERO(rpc->rstc);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: renesas-rpc-if: Silence clang warning
  2021-11-21 18:01 [PATCH] memory: renesas-rpc-if: Silence clang warning Lad Prabhakar
@ 2021-11-22  7:50 ` Geert Uytterhoeven
  2021-11-22  8:46   ` Lad, Prabhakar
  2021-11-22  9:54 ` Krzysztof Kozlowski
  1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-11-22  7:50 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Nathan Chancellor, Nick Desaulniers,
	Wolfram Sang, Biju Das, linux-renesas-soc, linux-kernel, llvm,
	Prabhakar

Hi Prabhakar,

On Sun, Nov 21, 2021 at 7:05 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> This patch silences the following clang warning:
>
> | drivers/memory/renesas-rpc-if.c:253:14: warning: cast to smaller integer
> | type 'enum rpcif_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> |           rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fixes: b04cc0d912eb8 ("memory: renesas-rpc-if: Add support for RZ/G2L")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/memory/renesas-rpc-if.c
> +++ b/drivers/memory/renesas-rpc-if.c
> @@ -250,7 +250,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
>                 return PTR_ERR(rpc->dirmap);
>         rpc->size = resource_size(res);
>
> -       rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> +       rpc->type = (enum rpcif_type)(uintptr_t)of_device_get_match_data(dev);

While correct, the cast to "enum rpcif_type" is not stricly needed anymore.

>         rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
>
>         return PTR_ERR_OR_ZERO(rpc->rstc);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: renesas-rpc-if: Silence clang warning
  2021-11-22  7:50 ` Geert Uytterhoeven
@ 2021-11-22  8:46   ` Lad, Prabhakar
  2021-11-22  9:32     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Lad, Prabhakar @ 2021-11-22  8:46 UTC (permalink / raw)
  To: Geert Uytterhoeven, Krzysztof Kozlowski
  Cc: Lad Prabhakar, Nathan Chancellor, Nick Desaulniers, Wolfram Sang,
	Biju Das, Linux-Renesas, LKML, llvm

Hi Geert,

Thank you for the review.

On Mon, Nov 22, 2021 at 7:50 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Sun, Nov 21, 2021 at 7:05 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > This patch silences the following clang warning:
> >
> > | drivers/memory/renesas-rpc-if.c:253:14: warning: cast to smaller integer
> > | type 'enum rpcif_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> > |           rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> > |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Fixes: b04cc0d912eb8 ("memory: renesas-rpc-if: Add support for RZ/G2L")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> > --- a/drivers/memory/renesas-rpc-if.c
> > +++ b/drivers/memory/renesas-rpc-if.c
> > @@ -250,7 +250,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
> >                 return PTR_ERR(rpc->dirmap);
> >         rpc->size = resource_size(res);
> >
> > -       rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> > +       rpc->type = (enum rpcif_type)(uintptr_t)of_device_get_match_data(dev);
>
> While correct, the cast to "enum rpcif_type" is not stricly needed anymore.
>
Agreed.

@Krzysztof, let me know if you want me to resend the patch with the
cast to "enum rpcif_type" dropped.

Cheers,
Prabhakar

> >         rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> >
> >         return PTR_ERR_OR_ZERO(rpc->rstc);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: renesas-rpc-if: Silence clang warning
  2021-11-22  8:46   ` Lad, Prabhakar
@ 2021-11-22  9:32     ` Krzysztof Kozlowski
  2021-11-22  9:34       ` Lad, Prabhakar
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-11-22  9:32 UTC (permalink / raw)
  To: Lad, Prabhakar, Geert Uytterhoeven
  Cc: Lad Prabhakar, Nathan Chancellor, Nick Desaulniers, Wolfram Sang,
	Biju Das, Linux-Renesas, LKML, llvm

On 22/11/2021 09:46, Lad, Prabhakar wrote:
> Hi Geert,
> 
> Thank you for the review.
> 
> On Mon, Nov 22, 2021 at 7:50 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>
>> Hi Prabhakar,
>>
>> On Sun, Nov 21, 2021 at 7:05 PM Lad Prabhakar
>> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
>>> This patch silences the following clang warning:
>>>
>>> | drivers/memory/renesas-rpc-if.c:253:14: warning: cast to smaller integer
>>> | type 'enum rpcif_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>>> |           rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
>>> |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> Fixes: b04cc0d912eb8 ("memory: renesas-rpc-if: Add support for RZ/G2L")
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>>
>> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>
>>> --- a/drivers/memory/renesas-rpc-if.c
>>> +++ b/drivers/memory/renesas-rpc-if.c
>>> @@ -250,7 +250,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
>>>                 return PTR_ERR(rpc->dirmap);
>>>         rpc->size = resource_size(res);
>>>
>>> -       rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
>>> +       rpc->type = (enum rpcif_type)(uintptr_t)of_device_get_match_data(dev);
>>
>> While correct, the cast to "enum rpcif_type" is not stricly needed anymore.
>>
> Agreed.
> 
> @Krzysztof, let me know if you want me to resend the patch with the
> cast to "enum rpcif_type" dropped.

I can fix it when applying, thanks!


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: renesas-rpc-if: Silence clang warning
  2021-11-22  9:32     ` Krzysztof Kozlowski
@ 2021-11-22  9:34       ` Lad, Prabhakar
  0 siblings, 0 replies; 6+ messages in thread
From: Lad, Prabhakar @ 2021-11-22  9:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Geert Uytterhoeven, Lad Prabhakar, Nathan Chancellor,
	Nick Desaulniers, Wolfram Sang, Biju Das, Linux-Renesas, LKML,
	llvm

On Mon, Nov 22, 2021 at 9:32 AM Krzysztof Kozlowski
<krzysztof.kozlowski@canonical.com> wrote:
>
> On 22/11/2021 09:46, Lad, Prabhakar wrote:
> > Hi Geert,
> >
> > Thank you for the review.
> >
> > On Mon, Nov 22, 2021 at 7:50 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >>
> >> Hi Prabhakar,
> >>
> >> On Sun, Nov 21, 2021 at 7:05 PM Lad Prabhakar
> >> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> >>> This patch silences the following clang warning:
> >>>
> >>> | drivers/memory/renesas-rpc-if.c:253:14: warning: cast to smaller integer
> >>> | type 'enum rpcif_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> >>> |           rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> >>> |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>>
> >>> Fixes: b04cc0d912eb8 ("memory: renesas-rpc-if: Add support for RZ/G2L")
> >>> Reported-by: kernel test robot <lkp@intel.com>
> >>> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >>
> >> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>
> >>> --- a/drivers/memory/renesas-rpc-if.c
> >>> +++ b/drivers/memory/renesas-rpc-if.c
> >>> @@ -250,7 +250,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
> >>>                 return PTR_ERR(rpc->dirmap);
> >>>         rpc->size = resource_size(res);
> >>>
> >>> -       rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> >>> +       rpc->type = (enum rpcif_type)(uintptr_t)of_device_get_match_data(dev);
> >>
> >> While correct, the cast to "enum rpcif_type" is not stricly needed anymore.
> >>
> > Agreed.
> >
> > @Krzysztof, let me know if you want me to resend the patch with the
> > cast to "enum rpcif_type" dropped.
>
> I can fix it when applying, thanks!
>
Thank you.

Cheers,
Prabhakar

>
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memory: renesas-rpc-if: Silence clang warning
  2021-11-21 18:01 [PATCH] memory: renesas-rpc-if: Silence clang warning Lad Prabhakar
  2021-11-22  7:50 ` Geert Uytterhoeven
@ 2021-11-22  9:54 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-11-22  9:54 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Biju Das, Nathan Chancellor,
	linux-renesas-soc, llvm, Wolfram Sang, Nick Desaulniers,
	linux-kernel, Prabhakar

On Sun, 21 Nov 2021 18:01:55 +0000, Lad Prabhakar wrote:
> This patch silences the following clang warning:
> 
> | drivers/memory/renesas-rpc-if.c:253:14: warning: cast to smaller integer
> | type 'enum rpcif_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> |           rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
> |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Applied, thanks!

[1/1] memory: renesas-rpc-if: Silence clang warning
      commit: 2602dc10f9d930bcc537467d13de4cfbfaa2126d

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-22  9:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21 18:01 [PATCH] memory: renesas-rpc-if: Silence clang warning Lad Prabhakar
2021-11-22  7:50 ` Geert Uytterhoeven
2021-11-22  8:46   ` Lad, Prabhakar
2021-11-22  9:32     ` Krzysztof Kozlowski
2021-11-22  9:34       ` Lad, Prabhakar
2021-11-22  9:54 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).