Hi Laurent, Thanks for the patch. On Sun, Mar 11, 2012 at 03:33:41PM +0100, Laurent Pinchart wrote: > From: Martin Hostettler <martin@xxxxxxxxxxxxxxxxxxxxxx> > > The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C. > > The driver creates a V4L2 subdevice. It currently supports cropping, gain, > exposure and v/h flipping controls in monochrome mode with an > external pixel clock. > > Signed-off-by: Martin Hostettler <martin@xxxxxxxxxxxxxxxxxxxxxx> > [Lots of clean up, fixes and enhancements] > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > --- > drivers/media/video/Kconfig | 8 + > drivers/media/video/Makefile | 1 + > drivers/media/video/mt9m032.c | 864 +++++++++++++++++++++++++++++++++++++++++ > include/media/mt9m032.h | 36 ++ > 4 files changed, 909 insertions(+), 0 deletions(-) > create mode 100644 drivers/media/video/mt9m032.c > create mode 100644 include/media/mt9m032.h ... > +static int mt9m032_update_timing(struct mt9m032 *sensor, > + struct v4l2_fract *interval) > +{ > + struct i2c_client *client = v4l2_get_subdevdata(&sensor->subdev); > + struct v4l2_rect *crop = &sensor->crop; > + unsigned int min_vblank; > + unsigned int vblank; > + u32 row_time; > + > + if (!interval) > + interval = &sensor->frame_interval; > + > + row_time = mt9m032_row_time(sensor, crop->width); > + > + vblank = div_u64(1000000000ULL * interval->numerator, > + (u64)row_time * interval->denominator) > + - crop->height; Shouldn't you check interval->denominator isn't zero? I don't think it's being done here or elsewhere, so dividing by zero looks possible here. > + if (vblank > MT9M032_VBLANK_MAX) { > + /* hardware limits to 11 bit values */ > + interval->denominator = 1000; > + interval->numerator = > + div_u64((crop->height + MT9M032_VBLANK_MAX) * > + (u64)row_time * interval->denominator, > + 1000000000ULL); > + vblank = div_u64(1000000000ULL * interval->numerator, > + (u64)row_time * interval->denominator) > + - crop->height; > + } > + /* enforce minimal 1.6ms blanking time. */ > + min_vblank = 1600000 / row_time; > + vblank = clamp_t(unsigned int, vblank, min_vblank, MT9M032_VBLANK_MAX); > + > + return mt9m032_write(client, MT9M032_VBLANK, vblank); > +} > + After addressing the above issue, Acked-by: Sakari Ailus <sakari.ailus@xxxxxx> Kind regards, -- Sakari Ailus e-mail: sakari.ailus@xxxxxx jabber/XMPP/Gmail: 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