[libcamera-devel] [PATCH 11/11] ipa: vimc: Validate configuration file in init()
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Apr 27 16:17:50 CEST 2020
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 at ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at 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;
> }
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list