staging: vc04_services: call sg_init_table to init scatterlist
authorMichael Zoran <mzoran@crowfest.net>
Fri, 28 Oct 2016 17:58:13 +0000 (10:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Nov 2016 10:01:43 +0000 (11:01 +0100)
Call the sg_init_table function to correctly initialze
the DMA scatterlist.  This function is required to completely
initialize the list and is mandatory if DMA debugging is
enabled in the build configuration.

One of the purposes of sg_init_table is to set
the magic "cookie" on each list element and ensure
the chain end is marked.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c

index 12938f2898a7de8b9ee0d2eda0598714af11a3ba..70807577641d93048a7efd2ad14755a4a3c3fa65 100644 (file)
@@ -453,6 +453,12 @@ create_pagelist(char __user *buf, size_t count, unsigned short type,
        pagelist->type = type;
        pagelist->offset = offset;
 
+       /*
+        * Initialize the scatterlist so that the magic cookie
+        *  is filled if debugging is enabled
+        */
+       sg_init_table(scatterlist, num_pages);
+       /* Now set the pages for each scatterlist */
        for (i = 0; i < num_pages; i++)
                sg_set_page(scatterlist + i, pages[i], PAGE_SIZE, 0);