All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: omap-100k: Remove casting the return value which is a void pointer
@ 2013-12-09 10:36 Jingoo Han
       [not found] ` <001801cef4ca$8c605e20$a5211a60$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jingoo Han @ 2013-12-09 10:36 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Jingoo Han',
	'Cory Maccarrone', 'Michal Nazarewicz'

Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 drivers/spi/spi-omap-100k.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
index 0d32054..35832a9 100644
--- a/drivers/spi/spi-omap-100k.c
+++ b/drivers/spi/spi-omap-100k.c
@@ -441,7 +441,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev)
 	 * You should allocate this with ioremap() before initializing
 	 * the SPI.
 	 */
-	spi100k->base = (void __iomem *)dev_get_platdata(&pdev->dev);
+	spi100k->base = dev_get_platdata(&pdev->dev);
 
 	spi100k->ick = devm_clk_get(&pdev->dev, "ick");
 	if (IS_ERR(spi100k->ick)) {
-- 
1.7.10.4


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

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

* Re: [PATCH] spi: omap-100k: Remove casting the return value which is a void pointer
       [not found] ` <001801cef4ca$8c605e20$a5211a60$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2013-12-09 11:21   ` Michal Nazarewicz
       [not found]     ` <8761qyuv6g.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Nazarewicz @ 2013-12-09 11:21 UTC (permalink / raw)
  To: Jingoo Han, 'Mark Brown'
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Jingoo Han',
	'Cory Maccarrone'

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

On Mon, Dec 09 2013, Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> Casting the return value which is a void pointer is redundant.
> The conversion from void pointer to any other pointer type is
> guaranteed by the C programming language.
>
> Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  drivers/spi/spi-omap-100k.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
> index 0d32054..35832a9 100644
> --- a/drivers/spi/spi-omap-100k.c
> +++ b/drivers/spi/spi-omap-100k.c
> @@ -441,7 +441,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev)
>  	 * You should allocate this with ioremap() before initializing
>  	 * the SPI.
>  	 */
> -	spi100k->base = (void __iomem *)dev_get_platdata(&pdev->dev);
> +	spi100k->base = dev_get_platdata(&pdev->dev);

I might be wrong, but I would assume that __iomem is the important bit
here and removing this cast will make linter unhappy.

>  
>  	spi100k->ick = devm_clk_get(&pdev->dev, "ick");
>  	if (IS_ERR(spi100k->ick)) {
> -- 
> 1.7.10.4

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] spi: omap-100k: Remove casting the return value which is a void pointer
       [not found]     ` <8761qyuv6g.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
@ 2013-12-09 11:55       ` Mark Brown
       [not found]         ` <20131209115536.GR29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2013-12-09 11:55 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Jingoo Han, linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Cory Maccarrone'

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Mon, Dec 09, 2013 at 12:21:11PM +0100, Michal Nazarewicz wrote:
> On Mon, Dec 09 2013, Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:

> > -	spi100k->base = (void __iomem *)dev_get_platdata(&pdev->dev);
> > +	spi100k->base = dev_get_platdata(&pdev->dev);

> I might be wrong, but I would assume that __iomem is the important bit
> here and removing this cast will make linter unhappy.

Yes, I'd expect so.  Jingoo have you tested with sparse?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] spi: omap-100k: Remove casting the return value which is a void pointer
       [not found]         ` <20131209115536.GR29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2013-12-09 12:09           ` Jingoo Han
  0 siblings, 0 replies; 4+ messages in thread
From: Jingoo Han @ 2013-12-09 12:09 UTC (permalink / raw)
  To: 'Mark Brown', 'Michal Nazarewicz'
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Cory Maccarrone',
	'Jingoo Han'

On Monday, December 09, 2013 8:56 PM, Mark Brown wrote:
> On Mon, Dec 09, 2013 at 12:21:11PM +0100, Michal Nazarewicz wrote:
> > On Mon, Dec 09 2013, Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> 
> > > -	spi100k->base = (void __iomem *)dev_get_platdata(&pdev->dev);
> > > +	spi100k->base = dev_get_platdata(&pdev->dev);
> 
> > I might be wrong, but I would assume that __iomem is the important bit
> > here and removing this cast will make linter unhappy.
> 
> Yes, I'd expect so.  Jingoo have you tested with sparse?

Oops, I didn't test sparse warning.
This patch makes sparse warning as below:

drivers/spi/spi-omap-100k.c:444:23: warning: incorrect type in assignment (different address spaces)
drivers/spi/spi-omap-100k.c:444:23:    expected void [noderef] <asn:2>*base
drivers/spi/spi-omap-100k.c:444:23:    got void *

Please, ignore this patch.
Sorry for annoying you. :-)

Best regards,
Jingoo Han

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

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

end of thread, other threads:[~2013-12-09 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 10:36 [PATCH] spi: omap-100k: Remove casting the return value which is a void pointer Jingoo Han
     [not found] ` <001801cef4ca$8c605e20$a5211a60$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-09 11:21   ` Michal Nazarewicz
     [not found]     ` <8761qyuv6g.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2013-12-09 11:55       ` Mark Brown
     [not found]         ` <20131209115536.GR29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-12-09 12:09           ` Jingoo Han

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.