linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: img-spfi: fix kbuild test robot warning
@ 2015-08-06  9:33 Sifan Naeem
       [not found] ` <1438853581-17154-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sifan Naeem @ 2015-08-06  9:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Sifan Naeem

drivers/spi/spi-img-spfi.c: In function 'img_spfi_setup':
drivers/spi/spi-img-spfi.c:446: warning: 'ret' may be used
uninitialized in this function.

Fixes: commit b03ba9e314c1 ("spi: img-spfi: fix multiple calls to request gpio")
Signed-off-by: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-img-spfi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index c253b2f798b4..823cbc92d1e7 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -444,7 +444,7 @@ static int img_spfi_unprepare(struct spi_master *master,
 
 static int img_spfi_setup(struct spi_device *spi)
 {
-	int ret;
+	int ret = -EINVAL;
 	struct img_spfi_device_data *spfi_data = spi_get_ctldata(spi);
 
 	if (!spfi_data) {
-- 
1.7.9.5

--
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: img-spfi: fix kbuild test robot warning
       [not found] ` <1438853581-17154-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
@ 2015-08-06 11:28   ` Mark Brown
       [not found]     ` <20150806112828.GU20873-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  2015-08-06 11:28   ` Applied "spi: img-spfi: fix kbuild test robot warning" to the spi tree Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-08-06 11:28 UTC (permalink / raw)
  To: Sifan Naeem; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

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

On Thu, Aug 06, 2015 at 10:33:01AM +0100, Sifan Naeem wrote:
> drivers/spi/spi-img-spfi.c: In function 'img_spfi_setup':
> drivers/spi/spi-img-spfi.c:446: warning: 'ret' may be used
> uninitialized in this function.
> 
> Fixes: commit b03ba9e314c1 ("spi: img-spfi: fix multiple calls to request gpio")
> Signed-off-by: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

This isn't a good commit message:

>  static int img_spfi_setup(struct spi_device *spi)
>  {
> -	int ret;
> +	int ret = -EINVAL;

You're just assigning a return value so that the compiler can't tell if
we've missed anything, that's often a sign of just papering over the
cracks without understanding the problem - for example there may be a
missing else case in some error path that the compiler was trying to
tell you about where other cleanup is needed.  The changelog should say
what the problem was and why the change solves it sensibly.

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

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

* Applied "spi: img-spfi: fix kbuild test robot warning" to the spi tree
       [not found] ` <1438853581-17154-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
  2015-08-06 11:28   ` Mark Brown
@ 2015-08-06 11:28   ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-08-06 11:28 UTC (permalink / raw)
  To: Sifan Naeem, Mark Brown, stable-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: img-spfi: fix kbuild test robot warning

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9176c6657b5c313cf504d157e6d91496ee5c8708 Mon Sep 17 00:00:00 2001
From: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Date: Thu, 6 Aug 2015 10:33:01 +0100
Subject: [PATCH] spi: img-spfi: fix kbuild test robot warning

drivers/spi/spi-img-spfi.c: In function 'img_spfi_setup':
drivers/spi/spi-img-spfi.c:446: warning: 'ret' may be used
uninitialized in this function.

Fixes: commit b03ba9e314c1 ("spi: img-spfi: fix multiple calls to request gpio")
Signed-off-by: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/spi/spi-img-spfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index 1ba9056..61f7748 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -443,7 +443,7 @@ static int img_spfi_unprepare(struct spi_master *master,
 
 static int img_spfi_setup(struct spi_device *spi)
 {
-	int ret;
+	int ret = -EINVAL;
 	struct img_spfi_device_data *spfi_data = spi_get_ctldata(spi);
 
 	if (!spfi_data) {
-- 
2.1.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: img-spfi: fix kbuild test robot warning
       [not found]     ` <20150806112828.GU20873-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-08-06 11:42       ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-08-06 11:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Sifan Naeem, linux-spi

On Thu, Aug 6, 2015 at 1:28 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Thu, Aug 06, 2015 at 10:33:01AM +0100, Sifan Naeem wrote:
>> drivers/spi/spi-img-spfi.c: In function 'img_spfi_setup':
>> drivers/spi/spi-img-spfi.c:446: warning: 'ret' may be used
>> uninitialized in this function.
>>
>> Fixes: commit b03ba9e314c1 ("spi: img-spfi: fix multiple calls to request gpio")
>> Signed-off-by: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
>
> This isn't a good commit message:
>
>>  static int img_spfi_setup(struct spi_device *spi)
>>  {
>> -     int ret;
>> +     int ret = -EINVAL;
>
> You're just assigning a return value so that the compiler can't tell if
> we've missed anything, that's often a sign of just papering over the
> cracks without understanding the problem - for example there may be a
> missing else case in some error path that the compiler was trying to
> tell you about where other cleanup is needed.  The changelog should say
> what the problem was and why the change solves it sensibly.

I'll bite...

It's not 100% clear to me -EINVAL is the right value.
Perhaps it should be 0?
Or the check for gpio_is_valid() should be removed?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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
--
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:[~2015-08-06 11:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06  9:33 [PATCH] spi: img-spfi: fix kbuild test robot warning Sifan Naeem
     [not found] ` <1438853581-17154-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-08-06 11:28   ` Mark Brown
     [not found]     ` <20150806112828.GU20873-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-08-06 11:42       ` Geert Uytterhoeven
2015-08-06 11:28   ` Applied "spi: img-spfi: fix kbuild test robot warning" to the spi tree Mark Brown

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).