diff mbox

[v8,3/4] intel-ipu3: cio2: add new MIPI-CSI2 driver

Message ID 1510266326-15516-1-git-send-email-yong.zhi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhi, Yong Nov. 9, 2017, 10:25 p.m. UTC
Hi, Sakari,

Fixed warnings about memset of pointer array and unsigned int used for 0 comparison
reported by static code analysis tool, please squash this to the driver, thanks!!

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Sakari Ailus Nov. 10, 2017, 6:14 p.m. UTC | #1
Hi Yong,

On Thu, Nov 09, 2017 at 02:25:26PM -0800, Yong Zhi wrote:
> Hi, Sakari,
> 
> Fixed warnings about memset of pointer array and unsigned int used for 0 comparison
> reported by static code analysis tool, please squash this to the driver, thanks!!

Done, thanks!

I've pushed the result to the ipu3 branch in my tree.
diff mbox

Patch

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 39d89ee..4295bdb 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -842,7 +842,7 @@  static int cio2_vb2_buf_init(struct vb2_buffer *vb)
 	unsigned int lops = DIV_ROUND_UP(pages + 1, entries_per_page);
 	struct sg_table *sg;
 	struct sg_page_iter sg_iter;
-	unsigned int i, j;
+	int i, j;
 
 	if (lops <= 0 || lops > CIO2_MAX_LOPS) {
 		dev_err(dev, "%s: bad buffer size (%i)\n", __func__,
@@ -850,7 +850,7 @@  static int cio2_vb2_buf_init(struct vb2_buffer *vb)
 		return -ENOSPC;		/* Should never happen */
 	}
 
-	memset(b->lop, 0, sizeof(*b->lop));
+	memset(b->lop, 0, sizeof(b->lop));
 	/* Allocate LOP table */
 	for (i = 0; i < lops; i++) {
 		b->lop[i] = dma_alloc_coherent(dev, CIO2_PAGE_SIZE,
@@ -880,7 +880,7 @@  static int cio2_vb2_buf_init(struct vb2_buffer *vb)
 	b->lop[i][j] = cio2->dummy_page_bus_addr >> PAGE_SHIFT;
 	return 0;
 fail:
-	for (; i >= 0; i--)
+	for (i--; i >= 0; i--)
 		dma_free_coherent(dev, CIO2_PAGE_SIZE,
 				  b->lop[i], b->lop_bus_addr[i]);
 	return -ENOMEM;