Commit ab8ef351 authored by Mark A. Allyn's avatar Mark A. Allyn Committed by Greg Kroah-Hartman
Browse files

staging: sep: NULL out pointers, mark debug code DEBUG to fix warnings



[This is picked out of the differences between the upstream driver and
 the staging driver. I'm resolving the differences as a series of updates -AC]

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ecd0cb00
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -40,6 +40,7 @@
/* #define SEP_PERF_DEBUG */
/* #define SEP_PERF_DEBUG */


#include <linux/init.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/fs.h>
@@ -197,9 +198,9 @@ static int sep_allocate_dmatables_region(struct sep_device *sep,
					 struct sep_dma_context *dma_ctx,
					 struct sep_dma_context *dma_ctx,
					 const u32 table_count)
					 const u32 table_count)
{
{
	const size_t new_len =  table_count *
	const size_t new_len =
				sizeof(struct sep_lli_entry) *
		SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES - 1;
				SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP;

	void *tmp_region = NULL;
	void *tmp_region = NULL;


	dev_dbg(&sep->pdev->dev, "[PID%d] dma_ctx = 0x%p\n",
	dev_dbg(&sep->pdev->dev, "[PID%d] dma_ctx = 0x%p\n",
@@ -230,6 +231,7 @@ static int sep_allocate_dmatables_region(struct sep_device *sep,
	if (*dmatables_region) {
	if (*dmatables_region) {
		memcpy(tmp_region, *dmatables_region, dma_ctx->dmatables_len);
		memcpy(tmp_region, *dmatables_region, dma_ctx->dmatables_len);
		kfree(*dmatables_region);
		kfree(*dmatables_region);
		*dmatables_region = NULL;
	}
	}


	*dmatables_region = tmp_region;
	*dmatables_region = tmp_region;
@@ -342,11 +344,12 @@ static void _sep_dump_message(struct sep_device *sep)


	u32 *p = sep->shared_addr;
	u32 *p = sep->shared_addr;


	for (count = 0; count < 40 * 4; count += 4)
	for (count = 0; count < 10 * 4; count += 4)
		dev_dbg(&sep->pdev->dev,
		dev_dbg(&sep->pdev->dev,
			"[PID%d] Word %d of the message is %x\n",
			"[PID%d] Word %d of the message is %x\n",
				current->pid, count/4, *p++);
				current->pid, count/4, *p++);
}
}

#endif
#endif


/**
/**
@@ -384,6 +387,8 @@ static void sep_unmap_and_free_shared_area(struct sep_device *sep)
				sep->shared_addr, sep->shared_bus);
				sep->shared_addr, sep->shared_bus);
}
}


#ifdef DEBUG

/**
/**
 * sep_shared_bus_to_virt - convert bus/virt addresses
 * sep_shared_bus_to_virt - convert bus/virt addresses
 * @sep: pointer to struct sep_device
 * @sep: pointer to struct sep_device
@@ -398,6 +403,8 @@ static void *sep_shared_bus_to_virt(struct sep_device *sep,
	return sep->shared_addr + (bus_address - sep->shared_bus);
	return sep->shared_addr + (bus_address - sep->shared_bus);
}
}


#endif

/**
/**
 * sep_open - device open method
 * sep_open - device open method
 * @inode: inode of SEP device
 * @inode: inode of SEP device