[libcamera-devel,2/4] libcamera: ipa: raspberrypi: focus: Fix for uninitialised variable

Message ID 20200626102531.1187650-3-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Focus feedback control
Related show

Commit Message

Naushir Patuck June 26, 2020, 10:25 a.m. UTC
Coverity static analysis check was reporting print_ was not initialised
before being used in process(). Add an explicit initialiser for print_
to the constructor.

Reported-by: Coverity CID=293456
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/ipa/raspberrypi/controller/rpi/focus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Plowman June 26, 2020, 12:30 p.m. UTC | #1
Hi Naush

Thanks for this. Looks good to me!

Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Best regards
David

On Fri, 26 Jun 2020 at 11:25, Naushir Patuck <naush@raspberrypi.com> wrote:
>
> Coverity static analysis check was reporting print_ was not initialised
> before being used in process(). Add an explicit initialiser for print_
> to the constructor.
>
> Reported-by: Coverity CID=293456
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> ---
>  src/ipa/raspberrypi/controller/rpi/focus.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> index 1e2b6491..4028ba56 100644
> --- a/src/ipa/raspberrypi/controller/rpi/focus.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> @@ -15,7 +15,7 @@ using namespace RPi;
>  #define NAME "rpi.focus"
>
>  Focus::Focus(Controller *controller)
> -       : Algorithm(controller)
> +       : Algorithm(controller), print_(false)
>  {
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart July 3, 2020, 1:02 a.m. UTC | #2
Hi Naush,

Thank you for the patch.

On Fri, Jun 26, 2020 at 11:25:29AM +0100, Naushir Patuck wrote:
> Coverity static analysis check was reporting print_ was not initialised
> before being used in process(). Add an explicit initialiser for print_
> to the constructor.
> 
> Reported-by: Coverity CID=293456
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

This looks good, but David submitted a patch that removes the print_
field, so this one won't be applicable anymore.

> ---
>  src/ipa/raspberrypi/controller/rpi/focus.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> index 1e2b6491..4028ba56 100644
> --- a/src/ipa/raspberrypi/controller/rpi/focus.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> @@ -15,7 +15,7 @@ using namespace RPi;
>  #define NAME "rpi.focus"
>  
>  Focus::Focus(Controller *controller)
> -	: Algorithm(controller)
> +	: Algorithm(controller), print_(false)
>  {
>  }
>
David Plowman July 3, 2020, 8:06 a.m. UTC | #3
Hi Naush, Laurent


On Fri, 3 Jul 2020 at 02:02, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Naush,
>
> Thank you for the patch.
>
> On Fri, Jun 26, 2020 at 11:25:29AM +0100, Naushir Patuck wrote:
> > Coverity static analysis check was reporting print_ was not initialised
> > before being used in process(). Add an explicit initialiser for print_
> > to the constructor.
> >
> > Reported-by: Coverity CID=293456
> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
>
> This looks good, but David submitted a patch that removes the print_
> field, so this one won't be applicable anymore.

Indeed, sorry for the churn. I think we just drop this particular
patch and it's all good.

Best regards
David

>
> > ---
> >  src/ipa/raspberrypi/controller/rpi/focus.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> > index 1e2b6491..4028ba56 100644
> > --- a/src/ipa/raspberrypi/controller/rpi/focus.cpp
> > +++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> > @@ -15,7 +15,7 @@ using namespace RPi;
> >  #define NAME "rpi.focus"
> >
> >  Focus::Focus(Controller *controller)
> > -     : Algorithm(controller)
> > +     : Algorithm(controller), print_(false)
> >  {
> >  }
> >
>
> --
> Regards,
>
> Laurent Pinchart
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp
index 1e2b6491..4028ba56 100644
--- a/src/ipa/raspberrypi/controller/rpi/focus.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp
@@ -15,7 +15,7 @@  using namespace RPi;
 #define NAME "rpi.focus"
 
 Focus::Focus(Controller *controller)
-	: Algorithm(controller)
+	: Algorithm(controller), print_(false)
 {
 }