* [PATCH] media: exynos-gsc: fix build warning @ 2014-11-18 10:57 Lad, Prabhakar 2014-11-25 15:04 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 4+ messages in thread From: Lad, Prabhakar @ 2014-11-18 10:57 UTC (permalink / raw) To: Kukjin Kim, Mauro Carvalho Chehab, LMML Cc: linux-samsung-soc, LKML, Lad, Prabhakar this patch fixes following build warning: gsc-core.c:350:17: warning: 'low_plane' may be used uninitialized gsc-core.c:371:31: warning: 'high_plane' may be used uninitialized Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> --- drivers/media/platform/exynos-gsc/gsc-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 91d226b..6c71b17 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -347,8 +347,8 @@ void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) s_chk_addr = frm->addr.cb; s_chk_len = frm->payload[1]; } else if (frm->fmt->num_planes == 3) { - u32 low_addr, low_plane, mid_addr, mid_plane; - u32 high_addr, high_plane; + u32 low_addr, low_plane = 0, mid_addr, mid_plane; + u32 high_addr, high_plane = 0; u32 t_min, t_max; t_min = min3(frm->addr.y, frm->addr.cb, frm->addr.cr); -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] media: exynos-gsc: fix build warning 2014-11-18 10:57 [PATCH] media: exynos-gsc: fix build warning Lad, Prabhakar @ 2014-11-25 15:04 ` Mauro Carvalho Chehab 2014-11-25 15:18 ` Prabhakar Lad 0 siblings, 1 reply; 4+ messages in thread From: Mauro Carvalho Chehab @ 2014-11-25 15:04 UTC (permalink / raw) To: Lad, Prabhakar Cc: Kukjin Kim, LMML, linux-samsung-soc, LKML, Sylwester Nawrocki Em Tue, 18 Nov 2014 10:57:48 +0000 "Lad, Prabhakar" <prabhakar.csengg@gmail.com> escreveu: > this patch fixes following build warning: > > gsc-core.c:350:17: warning: 'low_plane' may be used uninitialized > gsc-core.c:371:31: warning: 'high_plane' may be used uninitialized > > Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> > --- > drivers/media/platform/exynos-gsc/gsc-core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c > index 91d226b..6c71b17 100644 > --- a/drivers/media/platform/exynos-gsc/gsc-core.c > +++ b/drivers/media/platform/exynos-gsc/gsc-core.c > @@ -347,8 +347,8 @@ void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) > s_chk_addr = frm->addr.cb; > s_chk_len = frm->payload[1]; > } else if (frm->fmt->num_planes == 3) { > - u32 low_addr, low_plane, mid_addr, mid_plane; > - u32 high_addr, high_plane; > + u32 low_addr, low_plane = 0, mid_addr, mid_plane; > + u32 high_addr, high_plane = 0; > u32 t_min, t_max; > > t_min = min3(frm->addr.y, frm->addr.cb, frm->addr.cr); Actually, this just hides the error, without fixing. If the address is not found, a real error occurs, and the address is also invalid. So, I think that the enclosed patch will be doing a better job fixing it. Still, the entire code seems mostly useless on my eyes, as this function seems to be used only for debugging purposes, and errors there aren't actually handled properly. [PATCH] [media] exynos-gsc: fix build warning Fixes following build warnings: gsc-core.c:350:17: warning: 'low_plane' may be used uninitialized gsc-core.c:371:31: warning: 'high_plane' may be used uninitialized Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 91d226b8fe5c..3062e9fac6da 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -319,21 +319,22 @@ int gsc_enum_fmt_mplane(struct v4l2_fmtdesc *f) return 0; } -static u32 get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index) +static int get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index, u32 *ret_addr) { if (frm->addr.y == addr) { *index = 0; - return frm->addr.y; + *ret_addr = frm->addr.y; } else if (frm->addr.cb == addr) { *index = 1; - return frm->addr.cb; + *ret_addr = frm->addr.cb; } else if (frm->addr.cr == addr) { *index = 2; - return frm->addr.cr; + *ret_addr = frm->addr.cr; } else { pr_err("Plane address is wrong"); return -EINVAL; } + return 0; } void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) @@ -352,9 +353,11 @@ void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) u32 t_min, t_max; t_min = min3(frm->addr.y, frm->addr.cb, frm->addr.cr); - low_addr = get_plane_info(frm, t_min, &low_plane); + if (get_plane_info(frm, t_min, &low_plane, &low_addr)) + return; t_max = max3(frm->addr.y, frm->addr.cb, frm->addr.cr); - high_addr = get_plane_info(frm, t_max, &high_plane); + if (get_plane_info(frm, t_max, &high_plane, &high_addr)) + return; mid_plane = 3 - (low_plane + high_plane); if (mid_plane == 0) ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] media: exynos-gsc: fix build warning 2014-11-25 15:04 ` Mauro Carvalho Chehab @ 2014-11-25 15:18 ` Prabhakar Lad 2014-11-25 15:21 ` Prabhakar Lad 0 siblings, 1 reply; 4+ messages in thread From: Prabhakar Lad @ 2014-11-25 15:18 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Kukjin Kim, LMML, linux-samsung-soc, LKML, Sylwester Nawrocki Hi Mauro, On Tue, Nov 25, 2014 at 3:04 PM, Mauro Carvalho Chehab <mchehab@osg.samsung.com> wrote: > Em Tue, 18 Nov 2014 10:57:48 +0000 [Snip] > > -static u32 get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index) > +static int get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index, u32 *ret_addr) > { > if (frm->addr.y == addr) { > *index = 0; > - return frm->addr.y; > + *ret_addr = frm->addr.y; > } else if (frm->addr.cb == addr) { > *index = 1; > - return frm->addr.cb; > + *ret_addr = frm->addr.cb; > } else if (frm->addr.cr == addr) { > *index = 2; > - return frm->addr.cr; > + *ret_addr = frm->addr.cr; > } else { > pr_err("Plane address is wrong"); > return -EINVAL; > } > + return 0; the control wont reach here! may be you can remove the complete else part outside ? with that change, Reported-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Thanks, --Prabhakar Lad > } > > void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) > @@ -352,9 +353,11 @@ void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) > u32 t_min, t_max; > > t_min = min3(frm->addr.y, frm->addr.cb, frm->addr.cr); > - low_addr = get_plane_info(frm, t_min, &low_plane); > + if (get_plane_info(frm, t_min, &low_plane, &low_addr)) > + return; > t_max = max3(frm->addr.y, frm->addr.cb, frm->addr.cr); > - high_addr = get_plane_info(frm, t_max, &high_plane); > + if (get_plane_info(frm, t_max, &high_plane, &high_addr)) > + return; > > mid_plane = 3 - (low_plane + high_plane); > if (mid_plane == 0) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: exynos-gsc: fix build warning 2014-11-25 15:18 ` Prabhakar Lad @ 2014-11-25 15:21 ` Prabhakar Lad 0 siblings, 0 replies; 4+ messages in thread From: Prabhakar Lad @ 2014-11-25 15:21 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Kukjin Kim, LMML, linux-samsung-soc, LKML, Sylwester Nawrocki Hi, On Tue, Nov 25, 2014 at 3:18 PM, Prabhakar Lad <prabhakar.csengg@gmail.com> wrote: > Hi Mauro, > > On Tue, Nov 25, 2014 at 3:04 PM, Mauro Carvalho Chehab > <mchehab@osg.samsung.com> wrote: >> Em Tue, 18 Nov 2014 10:57:48 +0000 > [Snip] >> >> -static u32 get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index) >> +static int get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index, u32 *ret_addr) >> { >> if (frm->addr.y == addr) { >> *index = 0; >> - return frm->addr.y; >> + *ret_addr = frm->addr.y; >> } else if (frm->addr.cb == addr) { >> *index = 1; >> - return frm->addr.cb; >> + *ret_addr = frm->addr.cb; >> } else if (frm->addr.cr == addr) { >> *index = 2; >> - return frm->addr.cr; >> + *ret_addr = frm->addr.cr; >> } else { >> pr_err("Plane address is wrong"); >> return -EINVAL; >> } >> + return 0; > the control wont reach here! may be you can remove the complete else > part outside ? > Ah my bad :(, I missread 'ret_addr' to return. Thanks, --Prabhakar Lad > with that change, > > Reported-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> > Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> > > Thanks, > --Prabhakar Lad > >> } >> >> void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) >> @@ -352,9 +353,11 @@ void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm) >> u32 t_min, t_max; >> >> t_min = min3(frm->addr.y, frm->addr.cb, frm->addr.cr); >> - low_addr = get_plane_info(frm, t_min, &low_plane); >> + if (get_plane_info(frm, t_min, &low_plane, &low_addr)) >> + return; >> t_max = max3(frm->addr.y, frm->addr.cb, frm->addr.cr); >> - high_addr = get_plane_info(frm, t_max, &high_plane); >> + if (get_plane_info(frm, t_max, &high_plane, &high_addr)) >> + return; >> >> mid_plane = 3 - (low_plane + high_plane); >> if (mid_plane == 0) ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-25 15:21 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-18 10:57 [PATCH] media: exynos-gsc: fix build warning Lad, Prabhakar 2014-11-25 15:04 ` Mauro Carvalho Chehab 2014-11-25 15:18 ` Prabhakar Lad 2014-11-25 15:21 ` Prabhakar Lad
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox