RE: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Mauro and Sakari,

Sorry for the late response, the fix of the 2 warnings is attached.

Best regards,

Yong
________________________________________
From: Zhi, Yong
Sent: Friday, December 08, 2017 3:32 PM
To: Mauro Carvalho Chehab; Sakari Ailus
Cc: linux-media@xxxxxxxxxxxxxxx; Mani, Rajmohan
Subject: RE: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver

Hi, Mauro,

> -----Original Message-----
> From: Mauro Carvalho Chehab [mailto:mchehab@xxxxxxxxxxxxxxxx]
> Sent: Friday, December 8, 2017 7:00 AM
> To: Sakari Ailus <sakari.ailus@xxxxxx>
> Cc: linux-media@xxxxxxxxxxxxxxx; Mani, Rajmohan
> <rajmohan.mani@xxxxxxxxx>; Zhi, Yong <yong.zhi@xxxxxxxxx>
> Subject: Re: [RESEND GIT PULL for 4.16] Intel IPU3 CIO2 CSI-2 receiver driver
>
> Em Fri, 1 Dec 2017 16:31:36 +0200
> Sakari Ailus <sakari.ailus@xxxxxx> escreveu:
>
> > Hi Mauro,
> >
> > Here's the Intel IPU3 CIO2 CSI-2 receiver driver, with the
> > accompanying format definitions.
>
> This patch generates two warnings:
>
> drivers/media/pci/intel/ipu3/ipu3-cio2.c:1899:16: warning: Variable length
> array is used.
> drivers/media/pci/intel/ipu3/ipu3-cio2.c: In function 'cio2_pci_probe':
> drivers/media/pci/intel/ipu3/ipu3-cio2.c:1726:14: warning: variable 'phys'
> set but not used [-Wunused-but-set-variable]
>   phys_addr_t phys;
>               ^~~~
>
> We should never use variable-length array on Kernel, as Linux stack is very
> limited, and we have static analyzers to check for it at compilation time.
>
> Also, the logic should check if pci_resource_start() succeeded, instead of
> just ignoring it.
>
> Please fix.
>

Thanks for catching the warnings, for the variable size array, from the code context,
the size is limited to 128 bytes, maybe this language feature itself is not recommended,
we will send a patch to address above soon.

>
> >
> > Please pull.
> >
> >
> > The following changes since commit
> be9b53c83792e3898755dce90f8c632d40e7c83e:
> >
> >   media: dvb-frontends: complete kernel-doc markups (2017-11-30
> > 04:19:05 -0500)
> >
> > are available in the git repository at:
> >
> >   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> >
> > for you to fetch changes up to
> f178207daa68e817ab6fd702d81ed7c8637ab72c:
> >
> >   intel-ipu3: cio2: add new MIPI-CSI2 driver (2017-11-30 14:19:47
> > +0200)
> >
> > ----------------------------------------------------------------
> > Yong Zhi (3):
> >       videodev2.h, v4l2-ioctl: add IPU3 raw10 color format
> >       doc-rst: add IPU3 raw10 bayer pixel format definitions
> >       intel-ipu3: cio2: add new MIPI-CSI2 driver
> >
> >  Documentation/media/uapi/v4l/pixfmt-rgb.rst        |    1 +
> >  .../media/uapi/v4l/pixfmt-srggb10-ipu3.rst         |  335 ++++
> >  MAINTAINERS                                        |    8 +
> >  drivers/media/pci/Kconfig                          |    2 +
> >  drivers/media/pci/Makefile                         |    3 +-
> >  drivers/media/pci/intel/Makefile                   |    5 +
> >  drivers/media/pci/intel/ipu3/Kconfig               |   19 +
> >  drivers/media/pci/intel/ipu3/Makefile              |    1 +
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c           | 2052
> ++++++++++++++++++++
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.h           |  449 +++++
> >  drivers/media/v4l2-core/v4l2-ioctl.c               |    4 +
> >  include/uapi/linux/videodev2.h                     |    6 +
> >  12 files changed, 2884 insertions(+), 1 deletion(-)  create mode
> > 100644 Documentation/media/uapi/v4l/pixfmt-srggb10-ipu3.rst
> >  create mode 100644 drivers/media/pci/intel/Makefile  create mode
> > 100644 drivers/media/pci/intel/ipu3/Kconfig
> >  create mode 100644 drivers/media/pci/intel/ipu3/Makefile
> >  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.c
> >  create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.h
> >
>
>
>
> Thanks,
> Mauro
From d7e9baf13b1a8c8308906a7ed213f75d12756c24 Mon Sep 17 00:00:00 2001
From: Yong Zhi <yong.zhi@xxxxxxxxx>
Date: Tue, 12 Dec 2017 10:16:31 -0600
Subject: [PATCH] [PATCH v8] intel-ipu3: cio2: fix two warnings in the code

Fix two warnings reported by Mauro Carvalho Chehab:

ipu3-cio2.c:1899:16: warning: Variable length array is used.

In function 'cio2_pci_probe':
ipu3-cio2.c:1726:14: warning: variable 'phys' set
but not used [-Wunused-but-set-variable]

Hi, Sakari, can you squash the patch to your tree?

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

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 4295bdb8b192..941caa987dab 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1723,7 +1723,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
 			  const struct pci_device_id *id)
 {
 	struct cio2_device *cio2;
-	phys_addr_t phys;
 	void __iomem *const *iomap;
 	int r;
 
@@ -1741,8 +1740,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
 	dev_info(&pci_dev->dev, "device 0x%x (rev: 0x%x)\n",
 		 pci_dev->device, pci_dev->revision);
 
-	phys = pci_resource_start(pci_dev, CIO2_PCI_BAR);
-
 	r = pcim_iomap_regions(pci_dev, 1 << CIO2_PCI_BAR, pci_name(pci_dev));
 	if (r) {
 		dev_err(&pci_dev->dev, "failed to remap I/O memory (%d)\n", r);
@@ -1896,7 +1893,6 @@ static void arrange(void *ptr, size_t elem_size, size_t elems, size_t start)
 		{ 0, start - 1 },
 		{ start, elems - 1 },
 	};
-	u8 tmp[elem_size];
 
 #define arr_size(a) ((a)->end - (a)->begin + 1)
 
@@ -1915,12 +1911,12 @@ static void arrange(void *ptr, size_t elem_size, size_t elems, size_t start)
 
 		/* Swap the entries in two parts of the array. */
 		for (i = 0; i < size0; i++) {
-			memcpy(tmp, ptr + elem_size * (arr[1].begin + i),
-			       elem_size);
-			memcpy(ptr + elem_size * (arr[1].begin + i),
-			       ptr + elem_size * (arr[0].begin + i), elem_size);
-			memcpy(ptr + elem_size * (arr[0].begin + i), tmp,
-			       elem_size);
+			u8 *d = ptr + elem_size * (arr[1].begin + i);
+			u8 *s = ptr + elem_size * (arr[0].begin + i);
+			size_t j;
+
+			for (j = 0; j < elem_size; j++)
+				swap(d[j], s[j]);
 		}
 
 		if (arr_size(&arr[0]) > arr_size(&arr[1])) {
-- 
2.7.4


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux