Skip to content

[NPU] Fix coverity issues #31125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/plugins/intel_npu/src/backend/include/zero_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class ZeroDevice : public IDevice {
ZeroDevice& operator=(const ZeroDevice&) = delete;
ZeroDevice(const ZeroDevice&) = delete;

~ZeroDevice() = default;

private:
const std::shared_ptr<ZeroInitStructsHolder> _initStructs;

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_npu/src/backend/include/zero_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace intel_npu {

struct Pipeline {
struct Pipeline final {
public:
Pipeline(const Config& config,
const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
Expand All @@ -23,7 +23,7 @@ struct Pipeline {

Pipeline(const Pipeline&) = delete;
Pipeline& operator=(const Pipeline&) = delete;
virtual ~Pipeline() = default;
~Pipeline() = default;

void push();
void pull();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/src/common/src/filtered_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void FilteredConfig::addOrUpdateInternal(std::string key, std::string value) {
auto log = Logger::global().clone("Config");
if (_internal_compiler_configs.count(key) != 0) {
log.warning("Internal compiler option '%s' was already registered! Updating value only!", key.c_str());
_internal_compiler_configs.at(key) = value;
_internal_compiler_configs.at(key) = std::move(value);
} else {
// manual insert
_internal_compiler_configs.insert(std::make_pair(key, value)); // insert new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ std::vector<std::string> DriverCompilerAdapter::get_supported_options() const {
}

bool DriverCompilerAdapter::is_option_supported(std::string optname) const {
return _zeGraphExt->isOptionSupported(optname);
return _zeGraphExt->isOptionSupported(std::move(optname));
}

} // namespace intel_npu
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class BackendsRegistry final {
void operator=(const BackendsRegistry&) = delete;
void operator=(BackendsRegistry&&) = delete;

~BackendsRegistry() = default;

ov::SoPtr<IEngineBackend> getEngineBackend();

private:
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/intel_npu/src/plugin/include/metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ struct OpenvinoVersion {

OpenvinoVersion(const OpenvinoVersion& version);

OpenvinoVersion& operator=(const OpenvinoVersion& other) {
if (this != &other) {
_major = other.get_major();
_minor = other.get_minor();
_patch = other.get_patch();
}

return *this;
}

/**
* @brief Reads version data from a stream.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/src/plugin/include/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Plugin : public ov::IPlugin {

Plugin& operator=(const Plugin&) = delete;

virtual ~Plugin() = default;
~Plugin() = default;

void set_property(const ov::AnyMap& properties) override;

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_npu/src/plugin/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void update_log_level(const std::map<std::string, std::string>& propertiesMap) {
}
}

static ov::intel_npu::CompilerType resolveCompilerType(const FilteredConfig base_conf, const ov::AnyMap& local_conf) {
static ov::intel_npu::CompilerType resolveCompilerType(const FilteredConfig& base_conf, const ov::AnyMap& local_conf) {
// first look if provided config changes compiler type
auto it = local_conf.find(std::string(COMPILER_TYPE::key()));
if (it != local_conf.end()) {
Expand Down Expand Up @@ -175,7 +175,7 @@ void Plugin::init_options() {
auto dummyopt = details::makeOptionModel<OPT_TYPE>(); \
std::string o_name = dummyopt.key().data(); \
_options->add<OPT_TYPE>(); \
_globalConfig.enable(o_name, false); \
_globalConfig.enable(std::move(o_name), false); \
} while (0)

REGISTER_OPTION(LOG_LEVEL);
Expand Down
13 changes: 7 additions & 6 deletions src/plugins/intel_npu/src/plugin/src/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,13 @@ namespace intel_npu {
*
* @note This macro does not offer any compiled-model specific checks
*/
#define REGISTER_SIMPLE_METRIC(PROP_NAME, PROP_VISIBILITY, PROP_RETVAL) \
do { \
_properties.emplace(PROP_NAME.name(), \
std::make_tuple(PROP_VISIBILITY, ov::PropertyMutability::RO, [&](const Config& config) { \
return PROP_RETVAL; \
})); \
#define REGISTER_SIMPLE_METRIC(PROP_NAME, PROP_VISIBILITY, PROP_RETVAL) \
do { \
_properties.emplace(PROP_NAME.name(), \
std::make_tuple( \
PROP_VISIBILITY, \
ov::PropertyMutability::RO, \
[&](const Config& config) -> auto{ return PROP_RETVAL; })); \
} while (0)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class ZeroApi {
void operator=(const ZeroApi&) = delete;
void operator=(ZeroApi&&) = delete;

~ZeroApi() = default;

static const std::shared_ptr<ZeroApi>& getInstance();

#define symbol_statement(symbol) decltype(&::symbol) symbol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ struct ze_graph_dditable_ext_decorator final {
ze_graph_dditable_ext_decorator(const ze_graph_dditable_ext_decorator&) = delete;
ze_graph_dditable_ext_decorator(ze_graph_dditable_ext_decorator&&) = delete;

ze_graph_dditable_ext_decorator& operator=(const ze_graph_dditable_ext_decorator&) = delete;
ze_graph_dditable_ext_decorator& operator=(ze_graph_dditable_ext_decorator&&) = delete;

void throwWhenUnsupported(std::string_view func, uint32_t since) {
if (_driverExtVersion < since) {
OPENVINO_THROW("Driver Graph extension function ",
Expand Down Expand Up @@ -200,6 +203,9 @@ struct ze_command_queue_npu_dditable_ext_decorator final {
ze_command_queue_npu_dditable_ext_decorator(const ze_command_queue_npu_dditable_ext_decorator&) = delete;
ze_command_queue_npu_dditable_ext_decorator(ze_command_queue_npu_dditable_ext_decorator&&) = delete;

ze_command_queue_npu_dditable_ext_decorator& operator=(const ze_command_queue_npu_dditable_ext_decorator&) = delete;
ze_command_queue_npu_dditable_ext_decorator& operator=(ze_command_queue_npu_dditable_ext_decorator&&) = delete;

void throwWhenUnsupported(std::string_view func, uint32_t since) {
if (_commandQueueExtVersion < since) {
OPENVINO_THROW("Driver Command Queue extension function ",
Expand Down Expand Up @@ -242,6 +248,9 @@ struct ze_graph_profiling_ddi_table_ext_decorator final {
ze_graph_profiling_ddi_table_ext_decorator(const ze_graph_profiling_ddi_table_ext_decorator&) = delete;
ze_graph_profiling_ddi_table_ext_decorator(ze_graph_profiling_ddi_table_ext_decorator&&) = delete;

ze_graph_profiling_ddi_table_ext_decorator& operator=(const ze_graph_profiling_ddi_table_ext_decorator&) = delete;
ze_graph_profiling_ddi_table_ext_decorator& operator=(ze_graph_profiling_ddi_table_ext_decorator&&) = delete;

public:
ze_graph_profiling_ddi_table_ext_decorator(ze_graph_profiling_dditable_ext_last_t* impl)
: _impl(impl),
Expand Down
Loading