Skip to contentSkip to conversation

staging: vc04_services: bcm2835-camera: avoid multiple assignments

PATCH In review Payal Kshirsagar 3 participants 3 messages Mar 16, 2019 – Mar 17, 2019

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

PATCH 1/1 staging: vc04_services: bcm2835-camera: avoid multiple assignments

To avoid style issues, avoid multiple assignments.

---
 .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +8 -4
index d22b928..5e5b610 100644
@@ -1011,11 +1011,15 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev,
 		/* Make a further decision on port based on resolution */
 		if (f->fmt.pix.width <= max_video_width &&
 		    f->fmt.pix.height <= max_video_height)
-			camera_port = port =
-			    &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
+			camera_port = 
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
+			port =
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
 		else
-			camera_port = port =
-			    &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];
+			camera_port = 
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];
+			port =
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];
 		break;
 	case MMAL_COMPONENT_IMAGE_ENCODE:
 		encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE];
Signature · 1 line
2.7.4
#1 lore raw
Quoted 17 lines · Payal Kshirsagar

To avoid style issues, avoid multiple assignments.

---
 .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +1 -2
index d22b928..5e5b610 100644
@@ -1011,11 +1011,15 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev,
 		/* Make a further decision on port based on resolution */
 		if (f->fmt.pix.width <= max_video_width &&
 		    f->fmt.pix.height <= max_video_height)
-			camera_port = port =
-			    &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
+			camera_port =

drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c static int mmal_setup_components(struct bm2835_mmal_dev *dev, · line 1022

Quoted 10 lines
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +7 -2
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
+			port =
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
 		else
-			camera_port = port =
-			    &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];
+			camera_port =
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];
+			port =
+			&dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];

I don't think this code compiles. Also, duplicating the huge expression doesn't seem like an advantage.

julia

Quoted 13 lines
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +0 -1
 		break;
 	case MMAL_COMPONENT_IMAGE_ENCODE:
 		encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE];
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1552728839-7072-1-git-send-email-payal.s.kshirsagar.98%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#2 lore raw
In reply to Payal Kshirsagar
Quoted 2 lines · Payal Kshirsagar

To avoid style issues, avoid multiple assignments.

You need a blank line before the signed-off-by line for this to work properly.

Quoted 9 lines
---
 .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +0 -0
index d22b928..5e5b610 100644

drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c static int mmal_setup_components(struct bm2835_mmal_dev *dev, · line 1014

Quoted 6 lines
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +1 -2
@@ -1011,11 +1011,15 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev,
 		/* Make a further decision on port based on resolution */
 		if (f->fmt.pix.width <= max_video_width &&
 		    f->fmt.pix.height <= max_video_height)
-			camera_port = port =
-			    &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO];
+			camera_port = 

Did you run your patch through checkpatch.pl after making it? It should have complained about this line.

thanks,

greg k-h