OSDN Git Service

media: atomisp: align sizes returned by g_fmt
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 2 Nov 2021 07:39:18 +0000 (07:39 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 15 Nov 2021 08:11:44 +0000 (08:11 +0000)
Repeat the same round logic used inside s_fmt here, for the sake
of sanity.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_ioctl.c

index 936516d..8df052f 100644 (file)
@@ -892,8 +892,8 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh,
        }
 
        depth = atomisp_get_pixel_depth(f->fmt.pix.pixelformat);
-       f->fmt.pix.bytesperline = (f->fmt.pix.width * depth) >> 3;
-       f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
+       f->fmt.pix.bytesperline = DIV_ROUND_UP(f->fmt.pix.width * depth, 8);
+       f->fmt.pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height * f->fmt.pix.bytesperline);
 
        /*
         * FIXME: do we need to setup this differently, depending on the