Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1657545 > unrolled thread

[PATCH] spi: davinci: Fix compilation warning.

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-06-05 14:20 +0200
Last post2017-06-05 15:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] spi: davinci: Fix compilation warning. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-05 14:20 +0200
    Re: [PATCH] spi: davinci: Fix compilation warning. Geert Uytterhoeven <geert@linux-m68k.org> - 2017-06-05 15:10 +0200
      Re: [PATCH] spi: davinci: Fix compilation warning. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-05 15:30 +0200
        Re: [PATCH] spi: davinci: Fix compilation warning. Mark Brown <broonie@kernel.org> - 2017-06-05 15:50 +0200

#1657545 — [PATCH] spi: davinci: Fix compilation warning.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-06-05 14:20 +0200
Subject[PATCH] spi: davinci: Fix compilation warning.
Message-ID<tOZ9g-2Na-13@gated-at.bofh.it>
If CONFIG_OF is disable, it'll through compilation warning.

drivers/spi/spi-davinci.c: In function ‘spi_davinci_get_pdata’:
drivers/spi/spi-davinci.c:880:2: warning: return makes pointer from integer without a cast [enabled by default]
  return -ENODEV;

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/spi/spi-davinci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 2b0805d..93a4009 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -877,7 +877,7 @@ static int spi_davinci_get_pdata(struct platform_device *pdev,
 	*spi_davinci_get_pdata(struct platform_device *pdev,
 		struct davinci_spi *dspi)
 {
-	return -ENODEV;
+	return ERR_PTR(-ENODEV);
 }
 #endif
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1657583

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2017-06-05 15:10 +0200
Message-ID<tOZVD-3jm-3@gated-at.bofh.it>
In reply to#1657545
Hi Arvind,

On Mon, Jun 5, 2017 at 2:14 PM, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
> If CONFIG_OF is disable, it'll through compilation warning.
>
> drivers/spi/spi-davinci.c: In function ‘spi_davinci_get_pdata’:
> drivers/spi/spi-davinci.c:880:2: warning: return makes pointer from integer without a cast [enabled by default]
>   return -ENODEV;
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/spi/spi-davinci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index 2b0805d..93a4009 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -877,7 +877,7 @@ static int spi_davinci_get_pdata(struct platform_device *pdev,
>         *spi_davinci_get_pdata(struct platform_device *pdev,
>                 struct davinci_spi *dspi)
>  {
> -       return -ENODEV;
> +       return ERR_PTR(-ENODEV);
>  }
>  #endif

And you don't get a warning for spi_davinci_probe() doing

    int ret;

    ret = spi_davinci_get_pdata(pdev, dspi);

?

spi_davinci_get_pdata() returns int if CONFIG_OF, else a pointer.
I guess it always should return int instead.

It's been like this since the function was introduced, in commit
aae7147dfc522062 ("spi/davinci: add OF support for the spi controller").

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

[toc] | [prev] | [next] | [standalone]


#1657592

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-06-05 15:30 +0200
Message-ID<tP0eZ-3pX-7@gated-at.bofh.it>
In reply to#1657583
Hi,
  yes, You are right. we are getting this warning.
drivers/spi/spi-davinci.c: In function ‘davinci_spi_probe’:
drivers/spi/spi-davinci.c:919:7: warning: assignment makes integer from 
pointer without a cast [enabled by default]
    ret = spi_davinci_get_pdata(pdev, dspi);

We should return 'int' in both the case.

  Thanks
  ~arvind

On Monday 05 June 2017 06:37 PM, Geert Uytterhoeven wrote:
> Hi Arvind,
>
> On Mon, Jun 5, 2017 at 2:14 PM, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
>> If CONFIG_OF is disable, it'll through compilation warning.
>>
>> drivers/spi/spi-davinci.c: In function ‘spi_davinci_get_pdata’:
>> drivers/spi/spi-davinci.c:880:2: warning: return makes pointer from integer without a cast [enabled by default]
>>    return -ENODEV;
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>> ---
>>   drivers/spi/spi-davinci.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
>> index 2b0805d..93a4009 100644
>> --- a/drivers/spi/spi-davinci.c
>> +++ b/drivers/spi/spi-davinci.c
>> @@ -877,7 +877,7 @@ static int spi_davinci_get_pdata(struct platform_device *pdev,
>>          *spi_davinci_get_pdata(struct platform_device *pdev,
>>                  struct davinci_spi *dspi)
>>   {
>> -       return -ENODEV;
>> +       return ERR_PTR(-ENODEV);
>>   }
>>   #endif
> And you don't get a warning for spi_davinci_probe() doing
>
>      int ret;
>
>      ret = spi_davinci_get_pdata(pdev, dspi);
>
> ?
>
> spi_davinci_get_pdata() returns int if CONFIG_OF, else a pointer.
> I guess it always should return int instead.
>
> It's been like this since the function was introduced, in commit
> aae7147dfc522062 ("spi/davinci: add OF support for the spi controller").
>
> 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

[toc] | [prev] | [next] | [standalone]


#1657605

FromMark Brown <broonie@kernel.org>
Date2017-06-05 15:50 +0200
Message-ID<tP0ym-3wI-7@gated-at.bofh.it>
In reply to#1657592

[Multipart message — attachments visible in raw view] — view raw

On Mon, Jun 05, 2017 at 06:59:15PM +0530, Arvind Yadav wrote:
> Hi,
>  yes, You are right. we are getting this warning.
> drivers/spi/spi-davinci.c: In function ‘davinci_spi_probe’:

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web