Message ID | 20200427031713.14013-12-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Laurent, On Mon, Apr 27, 2020 at 06:17:13AM +0300, Laurent Pinchart wrote: > Make sure we can open the configuration file passed to the init() > function, and return an error otherwise. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > --- > src/ipa/vimc/vimc.cpp | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp > index e6bda8ec58b0..f29bc504d8c8 100644 > --- a/src/ipa/vimc/vimc.cpp > +++ b/src/ipa/vimc/vimc.cpp > @@ -19,6 +19,7 @@ > > #include <libipa/ipa_interface_wrapper.h> > > +#include "file.h" > #include "log.h" > > namespace libcamera { > @@ -65,7 +66,15 @@ int IPAVimc::init(const IPASettings &settings) > { > trace(IPAOperationInit); > > - LOG(IPAVimc, Debug) << "initializing vimc IPA!"; > + LOG(IPAVimc, Debug) > + << "initializing vimc IPA with configuration file " > + << settings.configurationFile; > + > + File conf(settings.configurationFile); > + if (!conf.open(File::ReadOnly)) { > + LOG(IPAVimc, Error) << "Failed to open configuration file"; > + return -EINVAL; > + } > > return 0; > } > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Laurent, On 27/04/2020 04:17, Laurent Pinchart wrote: > Make sure we can open the configuration file passed to the init() > function, and return an error otherwise. > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/ipa/vimc/vimc.cpp | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp > index e6bda8ec58b0..f29bc504d8c8 100644 > --- a/src/ipa/vimc/vimc.cpp > +++ b/src/ipa/vimc/vimc.cpp > @@ -19,6 +19,7 @@ > > #include <libipa/ipa_interface_wrapper.h> > > +#include "file.h" > #include "log.h" > > namespace libcamera { > @@ -65,7 +66,15 @@ int IPAVimc::init(const IPASettings &settings) > { > trace(IPAOperationInit); > > - LOG(IPAVimc, Debug) << "initializing vimc IPA!"; > + LOG(IPAVimc, Debug) > + << "initializing vimc IPA with configuration file " > + << settings.configurationFile; > + > + File conf(settings.configurationFile); > + if (!conf.open(File::ReadOnly)) { > + LOG(IPAVimc, Error) << "Failed to open configuration file"; > + return -EINVAL; > + } > > return 0; > } >
diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index e6bda8ec58b0..f29bc504d8c8 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -19,6 +19,7 @@ #include <libipa/ipa_interface_wrapper.h> +#include "file.h" #include "log.h" namespace libcamera { @@ -65,7 +66,15 @@ int IPAVimc::init(const IPASettings &settings) { trace(IPAOperationInit); - LOG(IPAVimc, Debug) << "initializing vimc IPA!"; + LOG(IPAVimc, Debug) + << "initializing vimc IPA with configuration file " + << settings.configurationFile; + + File conf(settings.configurationFile); + if (!conf.open(File::ReadOnly)) { + LOG(IPAVimc, Error) << "Failed to open configuration file"; + return -EINVAL; + } return 0; }
Make sure we can open the configuration file passed to the init() function, and return an error otherwise. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/ipa/vimc/vimc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)