All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Cc: swarren@wwwdotorg.org, lee@kernel.org, eric@anholt.net,
	f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com,
	outreachy-kernel@googlegroups.com
Subject: Re: [PATCH v3 1/2] staging: vc04_services: bcm2835-camera: Move min calculation outside the loop
Date: Mon, 6 Mar 2017 13:49:52 +0100	[thread overview]
Message-ID: <20170306124952.GA25968@kroah.com> (raw)
In-Reply-To: <e56b661d6e62e48626989f052a5e1603fb1e6913.1488381635.git.narcisaanamaria12@gmail.com>

On Wed, Mar 01, 2017 at 05:37:13PM +0200, Narcisa Ana Maria Vasile wrote:
> Instead of computing the minimum value in the for loop, store it in a variable.
> 
> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> ---
>  drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> index 53e275e..7b9d33c 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> @@ -1526,6 +1526,7 @@ static int get_num_cameras(struct vchiq_mmal_instance *instance,
>  	struct mmal_parameter_camera_info_t cam_info = {0};
>  	int param_size = sizeof(cam_info);
>  	int i;
> +	int min_size;
>  
>  	/* create a camera_info component */
>  	ret = vchiq_mmal_component_init(instance, "camera_info",
> @@ -1541,11 +1542,10 @@ static int get_num_cameras(struct vchiq_mmal_instance *instance,
>  					  &param_size)) {
>  		pr_info("Failed to get camera info\n");
>  	}
> -	for (i = 0;
> -	     i < (cam_info.num_cameras > num_resolutions ?
> -			num_resolutions :
> -			cam_info.num_cameras);
> -	     i++) {
> +
> +	min_size = cam_info.num_cameras > num_resolutions ?
> +		   num_resolutions : cam_info.num_cameras;

We have a min() macro, why not just use that instead?

thanks,

greg k-h


  reply	other threads:[~2017-03-06 12:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 11:43 [PATCH 0/2] staging: vc04_services: bcm2835-camera: Enhanced code readability Narcisa Ana Maria Vasile
2017-03-01 11:44 ` [PATCH 1/2] staging: vc04_services: bcm2835-camera: Moved condition outside the for statement Narcisa Ana Maria Vasile
2017-03-01 12:03   ` [Outreachy kernel] " Daniel Baluta
2017-03-01 11:45 ` [PATCH 2/2] staging: vc04_services: bcm2835-camera: Removed unnecessary variable Narcisa Ana Maria Vasile
2017-03-01 13:05   ` [Outreachy kernel] " Julia Lawall
2017-03-01 13:33     ` Narcisa Ana Maria Vasile
2017-03-01 13:19 ` [PATCH v2 0/2] staging: vc04_services: bcm2835-camera: Enhance code readability Narcisa Ana Maria Vasile
2017-03-01 13:20   ` [PATCH v2 1/2] staging: vc04_services: bcm2835-camera: Move min calculation outside the loop Narcisa Ana Maria Vasile
2017-03-01 13:20   ` [PATCH v2 2/2] staging: vc04_services: bcm2835-camera: Remove unnecessary variable Narcisa Ana Maria Vasile
2017-03-01 15:36 ` [PATCH v3 0/2] staging: vc04_services: bcm2835-camera: Enhance code readability Narcisa Ana Maria Vasile
2017-03-01 15:37   ` [PATCH v3 1/2] staging: vc04_services: bcm2835-camera: Move min calculation outside the loop Narcisa Ana Maria Vasile
2017-03-06 12:49     ` Greg KH [this message]
2017-03-06 12:56       ` Narcisa Ana Maria Vasile
2017-03-06 14:14         ` Greg KH
2017-03-06 12:55     ` Greg KH
2017-03-06 12:56       ` Greg KH
2017-03-01 15:37   ` [PATCH v3 2/2] staging: vc04_services: bcm2835-camera: Remove unnecessary variable Narcisa Ana Maria Vasile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170306124952.GA25968@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=eric@anholt.net \
    --cc=f.fainelli@gmail.com \
    --cc=lee@kernel.org \
    --cc=narcisaanamaria12@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=swarren@wwwdotorg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.