Moved spi_message off stack
authorTom Knot <tomasknot@gmail.com>
Mon, 25 Jun 2018 17:12:21 +0000 (19:12 +0200)
committerTom Knot <tomasknot@gmail.com>
Mon, 25 Jun 2018 17:12:21 +0000 (19:12 +0200)
modules/unipi/src/unipi_spi.c
version.txt

index cf49f32d84f8606edd0e63b3780457bfd20eb63b..00ac1490f463cc2a70c24d80ca41a1757533ed0b 100644 (file)
@@ -677,7 +677,7 @@ int neuronspi_spi_send_message(struct spi_device* spi_dev, u8 *send_buf, u8 *rec
        u16 recv_crc2 = 0;
        u16 packet_crc = 0;
        s32 trans_count = (len / NEURONSPI_MAX_TX) + 3; // number of transmissions
-       struct spi_message s_msg;
+       struct spi_message *s_msg;
        struct neuronspi_driver_data *d_data;
     struct spi_transfer* s_trans;
        mutex_lock(&neuronspi_master_mutex);
@@ -692,7 +692,8 @@ int neuronspi_spi_send_message(struct spi_device* spi_dev, u8 *send_buf, u8 *rec
                if (!send_header) {
                        trans_count -= 1;       // one less transmission as the header is omitted
                }
-               spi_message_init(&s_msg);
+               s_msg = kmalloc(sizeof(struct spi_message), GFP_ATOMIC);
+               spi_message_init(s_msg);
                for (i = 0; i < trans_count; i++) {
                        memset(&(s_trans[i]), 0, sizeof(s_trans[i]));
                        s_trans[i].delay_usecs = 0;
@@ -736,13 +737,14 @@ int neuronspi_spi_send_message(struct spi_device* spi_dev, u8 *send_buf, u8 *rec
                                // If len is more than NEURONSPI_MAX_TX * i (+ optionally header), then chunk len is NEURONSPI_MAX_TX (+ optionally header),
                                // otherwise it's the remainder
                        }
-                       spi_message_add_tail(&(s_trans[i]), &s_msg);
+                       spi_message_add_tail(&(s_trans[i]), s_msg);
                }
-               spi_sync(spi_dev, &s_msg);
+               spi_sync(spi_dev, s_msg);
                for (i = 0; i < trans_count; i++) {
                        spi_transfer_del(&(s_trans[i]));
                }
            kfree(s_trans);
+           kfree(s_msg);
 #if NEURONSPI_DETAILED_DEBUG > 1
                printk(KERN_INFO "NEURONSPI: SPI Master Read - %d:\n\t%100ph\n\t%100ph\n\t%100ph\n\t%100ph\n", len,recv_buf, &recv_buf[64],
                                &recv_buf[128], &recv_buf[192]);
index 869d1b9d1aaee24f57c941e79fbc80e3684289e7..f731ec4953db1c02e8f0f5b68beafae8059aae27 100644 (file)
@@ -1 +1 @@
-Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:51(211adc3) LatestCommit:Mon Jun 25 18:33:54 CEST 2018
+Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:52(f3d6c0f) LatestCommit:Mon Jun 25 19:12:21 CEST 2018