aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/nci
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@linux.intel.com>2013-09-23 12:02:43 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-25 08:21:09 -0400
commita4ada6cadb8a2246f263ff6a0d0cca8832f3970e (patch)
tree08250fa111f17418b86de18c2c62e53043fb2bc3 /net/nfc/nci
parent5ce3f32b5264b337bfd13a780452a17705307725 (diff)
NFC: NCI: zero struct spi_transfer variables before usage
Using ARM compiler, and without zero-ing spi_transfer, spi-s3c64xx driver would issue abnormal errors due to bpw field value being set to unexpected value. This structure MUST be set to all zeros except for those field specifically used. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/nci')
-rw-r--r--net/nfc/nci/spi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c
index 5c2234024774..c111506b36d1 100644
--- a/net/nfc/nci/spi.c
+++ b/net/nfc/nci/spi.c
@@ -44,6 +44,7 @@ static int __nci_spi_send(struct nci_spi *nspi, struct sk_buff *skb)
44 struct spi_message m; 44 struct spi_message m;
45 struct spi_transfer t; 45 struct spi_transfer t;
46 46
47 memset(&t, 0, sizeof(struct spi_transfer));
47 t.tx_buf = skb->data; 48 t.tx_buf = skb->data;
48 t.len = skb->len; 49 t.len = skb->len;
49 t.cs_change = 0; 50 t.cs_change = 0;
@@ -173,16 +174,21 @@ static struct sk_buff *__nci_spi_recv_frame(struct nci_spi *nspi)
173 int ret; 174 int ret;
174 175
175 spi_message_init(&m); 176 spi_message_init(&m);
177
178 memset(&tx, 0, sizeof(struct spi_transfer));
176 req[0] = NCI_SPI_DIRECT_READ; 179 req[0] = NCI_SPI_DIRECT_READ;
177 req[1] = nspi->acknowledge_mode; 180 req[1] = nspi->acknowledge_mode;
178 tx.tx_buf = req; 181 tx.tx_buf = req;
179 tx.len = 2; 182 tx.len = 2;
180 tx.cs_change = 0; 183 tx.cs_change = 0;
181 spi_message_add_tail(&tx, &m); 184 spi_message_add_tail(&tx, &m);
185
186 memset(&rx, 0, sizeof(struct spi_transfer));
182 rx.rx_buf = resp_hdr; 187 rx.rx_buf = resp_hdr;
183 rx.len = 2; 188 rx.len = 2;
184 rx.cs_change = 1; 189 rx.cs_change = 1;
185 spi_message_add_tail(&rx, &m); 190 spi_message_add_tail(&rx, &m);
191
186 ret = spi_sync(nspi->spi, &m); 192 ret = spi_sync(nspi->spi, &m);
187 193
188 if (ret) 194 if (ret)
@@ -199,11 +205,14 @@ static struct sk_buff *__nci_spi_recv_frame(struct nci_spi *nspi)
199 return NULL; 205 return NULL;
200 206
201 spi_message_init(&m); 207 spi_message_init(&m);
208
209 memset(&rx, 0, sizeof(struct spi_transfer));
202 rx.rx_buf = skb_put(skb, rx_len); 210 rx.rx_buf = skb_put(skb, rx_len);
203 rx.len = rx_len; 211 rx.len = rx_len;
204 rx.cs_change = 0; 212 rx.cs_change = 0;
205 rx.delay_usecs = nspi->xfer_udelay; 213 rx.delay_usecs = nspi->xfer_udelay;
206 spi_message_add_tail(&rx, &m); 214 spi_message_add_tail(&rx, &m);
215
207 ret = spi_sync(nspi->spi, &m); 216 ret = spi_sync(nspi->spi, &m);
208 217
209 if (ret) 218 if (ret)