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


Groups > linux.kernel > #1541862 > unrolled thread

[PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()

Started byGeert Uytterhoeven <geert@linux-m68k.org>
First post2016-12-14 12:30 +0100
Last post2016-12-15 14:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-12-14 12:30 +0100
    Applied "spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()" to the spi tree Mark Brown <broonie@kernel.org> - 2016-12-14 19:10 +0100
    RE: [PATCH] spi: fsl-lpspi: Pre-initialize ret in  fsl_lpspi_transfer_one_msg() Pandy Gao <pandy.gao@nxp.com> - 2016-12-15 14:40 +0100

#1541862 — [PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2016-12-14 12:30 +0100
Subject[PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()
Message-ID<sOfV0-5Pg-17@gated-at.bofh.it>
With gcc 4.1.2:

    drivers/spi/spi-fsl-lpspi.c: In function ‘fsl_lpspi_transfer_one_msg’:
    drivers/spi/spi-fsl-lpspi.c:369: warning: ‘ret’ may be used uninitialized in this function

If the message contains no transfers, the function will set the
message's status to an uninitialized value, and will return that
uninitialized value.

While __spi_validate() should have been called in all paths leading to
this, and thus have rejected such messages, we better pre-initialize ret
to be safe for future modifications (spi_transfer_one_message() also
does this).

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/spi/spi-fsl-lpspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index 52551f6d0c7ddf71..2b93bc605b91c5ec 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -366,7 +366,7 @@ static int fsl_lpspi_transfer_one_msg(struct spi_master *master,
 	struct spi_transfer *xfer;
 	bool is_first_xfer = true;
 	u32 temp;
-	int ret;
+	int ret = 0;
 
 	msg->status = 0;
 	msg->actual_length = 0;
-- 
1.9.1

[toc] | [next] | [standalone]


#1542094 — Applied "spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()" to the spi tree

FromMark Brown <broonie@kernel.org>
Date2016-12-14 19:10 +0100
SubjectApplied "spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()" to the spi tree
Message-ID<sOma5-1ze-9@gated-at.bofh.it>
In reply to#1541862
The patch

   spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()

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 cc4a7ffe02c95f537541c91e9842e3710decae6e Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Wed, 14 Dec 2016 12:20:55 +0100
Subject: [PATCH] spi: fsl-lpspi: Pre-initialize ret in
 fsl_lpspi_transfer_one_msg()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With gcc 4.1.2:

    drivers/spi/spi-fsl-lpspi.c: In function ‘fsl_lpspi_transfer_one_msg’:
    drivers/spi/spi-fsl-lpspi.c:369: warning: ‘ret’ may be used uninitialized in this function

If the message contains no transfers, the function will set the
message's status to an uninitialized value, and will return that
uninitialized value.

While __spi_validate() should have been called in all paths leading to
this, and thus have rejected such messages, we better pre-initialize ret
to be safe for future modifications (spi_transfer_one_message() also
does this).

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-fsl-lpspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index 52551f6d0c7d..2b93bc605b91 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -366,7 +366,7 @@ static int fsl_lpspi_transfer_one_msg(struct spi_master *master,
 	struct spi_transfer *xfer;
 	bool is_first_xfer = true;
 	u32 temp;
-	int ret;
+	int ret = 0;
 
 	msg->status = 0;
 	msg->actual_length = 0;
-- 
2.11.0

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


#1542737 — RE: [PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()

FromPandy Gao <pandy.gao@nxp.com>
Date2016-12-15 14:40 +0100
SubjectRE: [PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()
Message-ID<sOEqm-6j7-35@gated-at.bofh.it>
In reply to#1541862
> From: Geert Uytterhoeven [mailto:geert@linux-m68k.org]
> Sent: Wednesday, December 14, 2016 7:21 PM
> To: Mark Brown <broonie@kernel.org>; Pandy Gao
> <pandy.gao@nxp.com>
> Cc: linux-spi@vger.kernel.org; linux-kernel@vger.kernel.org; Geert
> Uytterhoeven <geert@linux-m68k.org>
> Subject: [PATCH] spi: fsl-lpspi: Pre-initialize ret in
> fsl_lpspi_transfer_one_msg()
> 
> With gcc 4.1.2:
> 
>     drivers/spi/spi-fsl-lpspi.c: In function ‘fsl_lpspi_transfer_one_msg’:
>     drivers/spi/spi-fsl-lpspi.c:369: warning: ‘ret’ may be used uninitialized
> in this function
> 
> If the message contains no transfers, the function will set the message's
> status to an uninitialized value, and will return that uninitialized value.
> 
> While __spi_validate() should have been called in all paths leading to this,
> and thus have rejected such messages, we better pre-initialize ret to be
> safe for future modifications (spi_transfer_one_message() also does this).
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---

Acked-by: Gao Pan <pandy.gao@nxp.com>

Best Regards
Pandy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web