From: Sakari Ailus <sakari.ailus@iki.fi>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: "Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Mauro Carvalho Chehab" <m.chehab@samsung.com>,
"Guennadi Liakhovetski" <g.liakhovetski@gmx.de>,
"Hans Verkuil" <hans.verkuil@cisco.com>,
"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
"Frank Schäfer" <fschaefer.oss@googlemail.com>,
"Ondrej Zary" <linux@rainbow-software.org>,
"open list:MT9M032 APTINA SE..." <linux-media@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] videodev2: Set vb2_rect's width and height as unsigned
Date: Wed, 6 Nov 2013 16:19:01 +0200 [thread overview]
Message-ID: <20131106141901.GD24988@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <1383742165-17634-1-git-send-email-ricardo.ribalda@gmail.com>
Hi Ricardo,
Thanks for the patch.
On Wed, Nov 06, 2013 at 01:49:25PM +0100, Ricardo Ribalda Delgado wrote:
...
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index ae66d91..9036e64 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -2028,8 +2028,8 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
> sel->r.width = min(sel->r.width, src_size->width);
> sel->r.height = min(sel->r.height, src_size->height);
>
> - sel->r.left = min(sel->r.left, src_size->width - sel->r.width);
> - sel->r.top = min(sel->r.top, src_size->height - sel->r.height);
> + sel->r.left = min(sel->r.left, (int) (src_size->width - sel->r.width));
> + sel->r.top = min(sel->r.top, (int) (src_size->height - sel->r.height));
How about min_t(int, ... instead?
> *crops[sel->pad] = sel->r;
>
> @@ -2121,8 +2121,10 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev,
>
> sel->r.left = max(0, sel->r.left & ~1);
> sel->r.top = max(0, sel->r.top & ~1);
> - sel->r.width = max(0, SMIAPP_ALIGN_DIM(sel->r.width, sel->flags));
> - sel->r.height = max(0, SMIAPP_ALIGN_DIM(sel->r.height, sel->flags));
> + sel->r.width = max_t(unsigned int, 0,
> + SMIAPP_ALIGN_DIM(sel->r.width, sel->flags));
> + sel->r.height = max_t(unsigned int, 0,
> + SMIAPP_ALIGN_DIM(sel->r.height, sel->flags));
The purpose of this check is to ensure the number is at least zero, and as
width and height are now unsigned, max_t() won't be needed anymore. Only
SMIAPP_ALIGN_DIM() is.
I can't see any harm from that, though --- there could be redundant checks
in other drivers, too.
> sel->r.width = max_t(unsigned int,
> sensor->limits[SMIAPP_LIMIT_MIN_X_OUTPUT_SIZE],
Do you think it'd be worth adding a note on this change to the list of V4L2
in each kernel version in Documentation/DocBook/media/v4l/compat.xml?
--
Kind regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
next prev parent reply other threads:[~2013-11-06 14:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 12:49 Ricardo Ribalda Delgado
2013-11-06 14:19 ` Sakari Ailus [this message]
2013-11-06 14:41 ` Ricardo Ribalda Delgado
2013-11-06 14:52 ` Laurent Pinchart
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=20131106141901.GD24988@valkosipuli.retiisi.org.uk \
--to=sakari.ailus@iki.fi \
--cc=fschaefer.oss@googlemail.com \
--cc=g.liakhovetski@gmx.de \
--cc=hans.verkuil@cisco.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@rainbow-software.org \
--cc=m.chehab@samsung.com \
--cc=prabhakar.csengg@gmail.com \
--cc=ricardo.ribalda@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
all inboxes | Powered by JetHome®