diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-04-27 05:09:58 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-04-28 01:54:57 +0300 |
commit | 8a9be175a76d34ed9fcf4c4f0233ef73736b8eab (patch) | |
tree | 656a033508b1714b8cf4583bf27f5e54b3595543 /src/ipa/vimc | |
parent | 32df46f0b6faf46b9d96852e4160c4817730f5e9 (diff) |
ipa: vimc: Validate configuration file in init()
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>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/vimc')
-rw-r--r-- | src/ipa/vimc/vimc.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index e6bda8ec..f29bc504 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; } |