public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Rui Miguel Silva <rmfrfs@gmail.com>
To: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org
Subject: Re: [PATCH 1/2] media: imx7-media-csi: don't store a floating pointer
Date: Wed, 20 Feb 2019 11:21:50 +0000	[thread overview]
Message-ID: <m3a7iqu2lt.fsf@gmail.com> (raw)
In-Reply-To: <1c186d5fd734e63305352986b6c5e84d19375787.1550582690.git.mchehab+samsung@kernel.org>

Oi Mauro,
On Tue 19 Feb 2019 at 13:24, Mauro Carvalho Chehab wrote:
> if imx7_csi_try_fmt() fails, outcc variable won't be
> initialized and csi->cc[IMX7_CSI_PAD_SRC] would be pointing
> to a random location.
>
> Signed-off-by: Mauro Carvalho Chehab 
> <mchehab+samsung@kernel.org>

Thanks for this, looks good.
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>

---
Cheers,
	Rui

> ---
>  drivers/staging/media/imx/imx7-media-csi.c | 18 
>  +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
> b/drivers/staging/media/imx/imx7-media-csi.c
> index d775e259fece..0b1788d79ce9 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/staging/media/imx/imx7-media-csi.c
> @@ -980,10 +980,10 @@ static int imx7_csi_get_fmt(struct 
> v4l2_subdev *sd,
>  	return ret;
>  }
>  
> -static void imx7_csi_try_fmt(struct imx7_csi *csi,
> -			     struct v4l2_subdev_pad_config *cfg,
> -			     struct v4l2_subdev_format *sdformat,
> -			     const struct imx_media_pixfmt **cc)
> +static int imx7_csi_try_fmt(struct imx7_csi *csi,
> +			    struct v4l2_subdev_pad_config *cfg,
> +			    struct v4l2_subdev_format *sdformat,
> +			    const struct imx_media_pixfmt **cc)
>  {
>  	const struct imx_media_pixfmt *in_cc;
>  	struct v4l2_mbus_framefmt *in_fmt;
> @@ -992,7 +992,7 @@ static void imx7_csi_try_fmt(struct imx7_csi 
> *csi,
>  	in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK,
>  				     sdformat->which);
>  	if (!in_fmt)
> -		return;
> +		return -EINVAL;
>  
>  	switch (sdformat->pad) {
>  	case IMX7_CSI_PAD_SRC:
> @@ -1023,8 +1023,10 @@ static void imx7_csi_try_fmt(struct 
> imx7_csi *csi,
>  						   false);
>  		break;
>  	default:
> +		return -EINVAL;
>  		break;
>  	}
> +	return 0;
>  }
>  
>  static int imx7_csi_set_fmt(struct v4l2_subdev *sd,
> @@ -1067,8 +1069,10 @@ static int imx7_csi_set_fmt(struct 
> v4l2_subdev *sd,
>  		format.pad = IMX7_CSI_PAD_SRC;
>  		format.which = sdformat->which;
>  		format.format = sdformat->format;
> -		imx7_csi_try_fmt(csi, cfg, &format, &outcc);
> -
> +		if (imx7_csi_try_fmt(csi, cfg, &format, &outcc)) {
> +			ret = -EINVAL;
> +			goto out_unlock;
> +		}
>  		outfmt = imx7_csi_get_format(csi, cfg, 
>  IMX7_CSI_PAD_SRC,
>  					     sdformat->which);
>  		*outfmt = format.format;


      parent reply	other threads:[~2019-02-20 11:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 13:24 [PATCH 1/2] media: imx7-media-csi: don't store a floating pointer Mauro Carvalho Chehab
2019-02-19 13:24 ` [PATCH 2/2] media: imx7-media-csi: get rid of unused var Mauro Carvalho Chehab
2019-02-20 11:23   ` Rui Miguel Silva
2019-02-20 11:21 ` Rui Miguel Silva [this message]

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=m3a7iqu2lt.fsf@gmail.com \
    --to=rmfrfs@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=mchehab@infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=slongerbeam@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox