Skip to contentSkip to conversation

media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()

PATCH In review Pavel Machek 3 participants 3 messages Dec 30, 2020 – Jan 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()

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

Fixes a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")

index 36e354ecf71e..e8ea69d30bfd 100644

drivers/media/pci/intel/ipu3/ipu3-cio2.c +1 -1
@@ -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;
 		}
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Tested-by Reviewed-by on v1 1/1
#1 lore raw

Hi Pavel,

Thank you for the patch.

Quoted 5 lines · Pavel Machek

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

Fixes a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")
Quoted 13 lines

index 36e354ecf71e..e8ea69d30bfd 100644

drivers/media/pci/intel/ipu3/ipu3-cio2.c +1 -1
@@ -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;
 		}
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#2 lore raw
Quoted 5 lines · Laurent Pinchart

Hi Pavel,

Thank you for the patch.

On Wed, Dec 30, 2020 at 01:55:50PM +0100, Pavel Machek wrote:

Quoted 8 lines
Quoted 5 lines

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

Fixes a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")

Thanks!

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

Cc [email protected] # v4.16 and up
Quoted 19 lines
Quoted 14 lines

index 36e354ecf71e..e8ea69d30bfd 100644

drivers/media/pci/intel/ipu3/ipu3-cio2.c +1 -1
@@ -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;
 		}
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 1 line
Sakari Ailus