linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()
@ 2020-12-30 12:55 Pavel Machek
  2020-12-30 21:20 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2020-12-30 12:55 UTC (permalink / raw)
  To: sakari.ailus, andy.shevchenko, laurent.pinchart, mchehab+huawei,
	yong.zhi, bingbu.cao, tian.shu.qiu, linux-media, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

Loop was useless as it would always exit on the first iteration. Fix
it with right condition. 

Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
Fixes: a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")

index 36e354ecf71e..e8ea69d30bfd 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1269,7 +1269,7 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd,
 	fmt->format.code = formats[0].mbus_code;
 
 	for (i = 0; i < ARRAY_SIZE(formats); i++) {
-		if (formats[i].mbus_code == fmt->format.code) {
+		if (formats[i].mbus_code == mbus_code) {
 			fmt->format.code = mbus_code;
 			break;
 		}

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()
  2020-12-30 12:55 [PATCH] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() Pavel Machek
@ 2020-12-30 21:20 ` Laurent Pinchart
  2021-01-02 17:27   ` Sakari Ailus
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2020-12-30 21:20 UTC (permalink / raw)
  To: Pavel Machek
  Cc: sakari.ailus, andy.shevchenko, mchehab+huawei, yong.zhi,
	bingbu.cao, tian.shu.qiu, linux-media, linux-kernel

Hi Pavel,

Thank you for the patch.

On Wed, Dec 30, 2020 at 01:55:50PM +0100, Pavel Machek wrote:
> Loop was useless as it would always exit on the first iteration. Fix
> it with right condition. 
> 
> Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
> Fixes: a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")

Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> index 36e354ecf71e..e8ea69d30bfd 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -1269,7 +1269,7 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd,
>  	fmt->format.code = formats[0].mbus_code;
>  
>  	for (i = 0; i < ARRAY_SIZE(formats); i++) {
> -		if (formats[i].mbus_code == fmt->format.code) {
> +		if (formats[i].mbus_code == mbus_code) {
>  			fmt->format.code = mbus_code;
>  			break;
>  		}
> 

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()
  2020-12-30 21:20 ` Laurent Pinchart
@ 2021-01-02 17:27   ` Sakari Ailus
  0 siblings, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2021-01-02 17:27 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Pavel Machek, andy.shevchenko, mchehab+huawei, yong.zhi,
	bingbu.cao, tian.shu.qiu, linux-media, linux-kernel

On Wed, Dec 30, 2020 at 11:20:09PM +0200, Laurent Pinchart wrote:
> Hi Pavel,
> 
> Thank you for the patch.
> 
> On Wed, Dec 30, 2020 at 01:55:50PM +0100, Pavel Machek wrote:
> > Loop was useless as it would always exit on the first iteration. Fix
> > it with right condition. 
> > 
> > Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
> > Fixes: a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")
> 
> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Thanks!

As this should go to stable, I'm adding:

	Cc: stable@vger.kernel.org # v4.16 and up

> 
> > index 36e354ecf71e..e8ea69d30bfd 100644
> > --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > @@ -1269,7 +1269,7 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd,
> >  	fmt->format.code = formats[0].mbus_code;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(formats); i++) {
> > -		if (formats[i].mbus_code == fmt->format.code) {
> > +		if (formats[i].mbus_code == mbus_code) {
> >  			fmt->format.code = mbus_code;
> >  			break;
> >  		}
> > 
> 
> -- 
> Regards,
> 
> Laurent Pinchart

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-02 17:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 12:55 [PATCH] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() Pavel Machek
2020-12-30 21:20 ` Laurent Pinchart
2021-01-02 17:27   ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).