* [PATCH v2] spi-topcliff-pch: fix -Wuninitialized warning
@ 2012-02-14 14:35 Danny Kukawka
[not found] ` <1329230103-26465-1-git-send-email-danny.kukawka-2YacvwyR+KOzQB+pC5nmwQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Danny Kukawka @ 2012-02-14 14:35 UTC (permalink / raw)
To: Grant Likely
Cc: Jiri Kosina, Danny Kukawka, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Fix for:
drivers/spi/spi-topcliff-pch.c: In function ‘pch_spi_handler_sub’:
drivers/spi/spi-topcliff-pch.c:325:17: warning: ‘bpw_len’ may be
used uninitialized in this function [-Wuninitialized]
drivers/spi/spi-topcliff-pch.c:325:42: warning: ‘rx_index’ may be
used uninitialized in this function [-Wuninitialized]
drivers/spi/spi-topcliff-pch.c:325:42: warning: ‘tx_index’ may be
used uninitialized in this function [-Wuninitialized]
Move usage of tx_index, rx_index and bpw_len into the same
block as where they are set to prevent uninitialized usage.
v2: instead of init variables with 0 move the whole block
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
drivers/spi/spi-topcliff-pch.c | 33 +++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 10182eb..1107469 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -318,22 +318,23 @@ static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val,
data->tx_index = tx_index;
data->rx_index = rx_index;
- }
-
- /* if transfer complete interrupt */
- if (reg_spsr_val & SPSR_FI_BIT) {
- if ((tx_index == bpw_len) && (rx_index == tx_index)) {
- /* disable interrupts */
- pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL);
-
- /* transfer is completed;
- inform pch_spi_process_messages */
- data->transfer_complete = true;
- data->transfer_active = false;
- wake_up(&data->wait);
- } else {
- dev_err(&data->master->dev,
- "%s : Transfer is not completed", __func__);
+ /* if transfer complete interrupt */
+ if (reg_spsr_val & SPSR_FI_BIT) {
+ if ((tx_index == bpw_len) && (rx_index == tx_index)) {
+ /* disable interrupts */
+ pch_spi_setclr_reg(data->master, PCH_SPCR, 0,
+ PCH_ALL);
+
+ /* transfer is completed;
+ inform pch_spi_process_messages */
+ data->transfer_complete = true;
+ data->transfer_active = false;
+ wake_up(&data->wait);
+ } else {
+ dev_err(&data->master->dev,
+ "%s : Transfer is not completed",
+ __func__);
+ }
}
}
}
--
1.7.7.3
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <1329230103-26465-1-git-send-email-danny.kukawka-2YacvwyR+KOzQB+pC5nmwQ@public.gmane.org>]
* Re: [PATCH v2] spi-topcliff-pch: fix -Wuninitialized warning [not found] ` <1329230103-26465-1-git-send-email-danny.kukawka-2YacvwyR+KOzQB+pC5nmwQ@public.gmane.org> @ 2012-03-09 21:43 ` Grant Likely 0 siblings, 0 replies; 2+ messages in thread From: Grant Likely @ 2012-03-09 21:43 UTC (permalink / raw) To: Danny Kukawka Cc: Jiri Kosina, Danny Kukawka, linux-kernel-u79uwXL29TY76Z2rM5mHXA, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2561 bytes --] On Tue, 14 Feb 2012 15:35:03 +0100, Danny Kukawka <danny.kukawka-2YacvwyR+KOzQB+pC5nmwQ@public.gmane.org> wrote: > Fix for: > drivers/spi/spi-topcliff-pch.c: In function ‘pch_spi_handler_sub’: > drivers/spi/spi-topcliff-pch.c:325:17: warning: ‘bpw_len’ may be > used uninitialized in this function [-Wuninitialized] > drivers/spi/spi-topcliff-pch.c:325:42: warning: ‘rx_index’ may be > used uninitialized in this function [-Wuninitialized] > drivers/spi/spi-topcliff-pch.c:325:42: warning: ‘tx_index’ may be > used uninitialized in this function [-Wuninitialized] > > Move usage of tx_index, rx_index and bpw_len into the same > block as where they are set to prevent uninitialized usage. > > v2: instead of init variables with 0 move the whole block > > Signed-off-by: Danny Kukawka <danny.kukawka-2YacvwyR+KOzQB+pC5nmwQ@public.gmane.org> Applied, thanks g. > --- > drivers/spi/spi-topcliff-pch.c | 33 +++++++++++++++---------------- > 1 files changed, 17 insertions(+), 16 deletions(-) > > diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c > index 10182eb..1107469 100644 > --- a/drivers/spi/spi-topcliff-pch.c > +++ b/drivers/spi/spi-topcliff-pch.c > @@ -318,22 +318,23 @@ static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val, > data->tx_index = tx_index; > data->rx_index = rx_index; > > - } > - > - /* if transfer complete interrupt */ > - if (reg_spsr_val & SPSR_FI_BIT) { > - if ((tx_index == bpw_len) && (rx_index == tx_index)) { > - /* disable interrupts */ > - pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL); > - > - /* transfer is completed; > - inform pch_spi_process_messages */ > - data->transfer_complete = true; > - data->transfer_active = false; > - wake_up(&data->wait); > - } else { > - dev_err(&data->master->dev, > - "%s : Transfer is not completed", __func__); > + /* if transfer complete interrupt */ > + if (reg_spsr_val & SPSR_FI_BIT) { > + if ((tx_index == bpw_len) && (rx_index == tx_index)) { > + /* disable interrupts */ > + pch_spi_setclr_reg(data->master, PCH_SPCR, 0, > + PCH_ALL); > + > + /* transfer is completed; > + inform pch_spi_process_messages */ > + data->transfer_complete = true; > + data->transfer_active = false; > + wake_up(&data->wait); > + } else { > + dev_err(&data->master->dev, > + "%s : Transfer is not completed", > + __func__); > + } > } > } > } > -- > 1.7.7.3 > -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies,Ltd. [-- Attachment #2: Type: text/plain, Size: 317 bytes --] ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ [-- Attachment #3: Type: text/plain, Size: 210 bytes --] _______________________________________________ spi-devel-general mailing list spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/spi-devel-general ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-09 21:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-14 14:35 [PATCH v2] spi-topcliff-pch: fix -Wuninitialized warning Danny Kukawka
[not found] ` <1329230103-26465-1-git-send-email-danny.kukawka-2YacvwyR+KOzQB+pC5nmwQ@public.gmane.org>
2012-03-09 21:43 ` Grant Likely
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).