Hi Jean-Christophe, On Fri, Dec 16, 2016 at 02:32:15PM +0100, Jean-Christophe Trotin wrote: > Correct the calculation of the rounding to nearest aligned value in > the clamp_align() function. For example, clamp_align(1277, 1, 9600, 2) > returns 1276, while it should return 1280. Why should the function return 1280 instead of 1276, which is closer to 1277? > > Signed-off-by: Jean-Christophe Trotin <jean-christophe.trotin@xxxxxx> > --- > drivers/media/v4l2-core/v4l2-common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c > index 57cfe26a..2970ce7 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/drivers/media/v4l2-core/v4l2-common.c > @@ -315,7 +315,7 @@ static unsigned int clamp_align(unsigned int x, unsigned int min, > > /* Round to nearest aligned value */ > if (align) > - x = (x + (1 << (align - 1))) & mask; > + x = (x + ((1 << align) - 1)) & mask; > > return x; > } -- Regards, Sakari Ailus e-mail: sakari.ailus@xxxxxx XMPP: sailus@xxxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html