diff mbox series

[22/75] media: imx: capture: Remove unneeded variable in __capture_legacy_try_fmt

Message ID 20210105152852.5733-23-laurent.pinchart@ideasonboard.com (mailing list archive)
State New
Headers show
Series media: imx: Miscellaneous fixes and cleanups for i.MX7 | expand

Commit Message

Laurent Pinchart Jan. 5, 2021, 3:27 p.m. UTC
The __capture_legacy_try_fmt() function doesn't need two
imx_media_pixfmt pointer variables. Remove one of them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-capture.c | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 deletions(-)

Comments

Steve Longerbeam Jan. 6, 2021, 5:55 p.m. UTC | #1
On 1/5/21 7:27 AM, Laurent Pinchart wrote:
> The __capture_legacy_try_fmt() function doesn't need two
> imx_media_pixfmt pointer variables. Remove one of them.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>   drivers/staging/media/imx/imx-media-capture.c | 20 +++++++++----------
>   1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index 70b3d187bbc3..7932b7f0f4f2 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -236,16 +236,16 @@ static int __capture_legacy_try_fmt(struct capture_priv *priv,
>   				    const struct imx_media_pixfmt **retcc,
>   				    struct v4l2_rect *compose)
>   {
> -	const struct imx_media_pixfmt *cc, *cc_src;
> +	const struct imx_media_pixfmt *cc;
>   
> -	cc_src = imx_media_find_ipu_format(fmt_src->format.code,
> -					   PIXFMT_SEL_YUV_RGB);
> -	if (cc_src) {
> +	cc = imx_media_find_ipu_format(fmt_src->format.code,
> +				       PIXFMT_SEL_YUV_RGB);
> +	if (cc) {
>   		enum imx_pixfmt_sel fmt_sel;
>   		u32 fourcc;
>   
> -		fmt_sel = (cc_src->cs == IPUV3_COLORSPACE_YUV) ?
> -			PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;
> +		fmt_sel = (cc->cs == IPUV3_COLORSPACE_YUV)
> +			? PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;
>   		fourcc = f->fmt.pix.pixelformat;
>   
>   		cc = imx_media_find_pixel_format(fourcc, fmt_sel);
> @@ -254,12 +254,10 @@ static int __capture_legacy_try_fmt(struct capture_priv *priv,
>   			cc = imx_media_find_pixel_format(fourcc, fmt_sel);
>   		}
>   	} else {
> -		cc_src = imx_media_find_mbus_format(fmt_src->format.code,
> -						    PIXFMT_SEL_ANY);
> -		if (WARN_ON(!cc_src))
> +		cc = imx_media_find_mbus_format(fmt_src->format.code,
> +						PIXFMT_SEL_ANY);
> +		if (WARN_ON(!cc))
>   			return -EINVAL;
> -
> -		cc = cc_src;
>   	}
>   
>   	/* allow IDMAC interweave but enforce field order from source */

Reviewed-by: Steve Longerbeam <slongerbeam@gmail.com>
diff mbox series

Patch

diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index 70b3d187bbc3..7932b7f0f4f2 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -236,16 +236,16 @@  static int __capture_legacy_try_fmt(struct capture_priv *priv,
 				    const struct imx_media_pixfmt **retcc,
 				    struct v4l2_rect *compose)
 {
-	const struct imx_media_pixfmt *cc, *cc_src;
+	const struct imx_media_pixfmt *cc;
 
-	cc_src = imx_media_find_ipu_format(fmt_src->format.code,
-					   PIXFMT_SEL_YUV_RGB);
-	if (cc_src) {
+	cc = imx_media_find_ipu_format(fmt_src->format.code,
+				       PIXFMT_SEL_YUV_RGB);
+	if (cc) {
 		enum imx_pixfmt_sel fmt_sel;
 		u32 fourcc;
 
-		fmt_sel = (cc_src->cs == IPUV3_COLORSPACE_YUV) ?
-			PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;
+		fmt_sel = (cc->cs == IPUV3_COLORSPACE_YUV)
+			? PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;
 		fourcc = f->fmt.pix.pixelformat;
 
 		cc = imx_media_find_pixel_format(fourcc, fmt_sel);
@@ -254,12 +254,10 @@  static int __capture_legacy_try_fmt(struct capture_priv *priv,
 			cc = imx_media_find_pixel_format(fourcc, fmt_sel);
 		}
 	} else {
-		cc_src = imx_media_find_mbus_format(fmt_src->format.code,
-						    PIXFMT_SEL_ANY);
-		if (WARN_ON(!cc_src))
+		cc = imx_media_find_mbus_format(fmt_src->format.code,
+						PIXFMT_SEL_ANY);
+		if (WARN_ON(!cc))
 			return -EINVAL;
-
-		cc = cc_src;
 	}
 
 	/* allow IDMAC interweave but enforce field order from source */