@@ -481,22 +481,14 @@ Device::~Device() {
481481 delete vaCacheMap_;
482482 }
483483
484- if (vaCacheAccess_) {
485- delete vaCacheAccess_;
486- }
484+ delete vaCacheAccess_;
487485
488486 if (arena_mem_obj_ != nullptr ) {
489487 arena_mem_obj_->release ();
490488 }
491489
492- // Destroy device settings
493- if (settings_ != nullptr ) {
494- delete settings_;
495- }
496-
497- if (info_.extensions_ != nullptr ) {
498- delete[] info_.extensions_ ;
499- }
490+ delete settings_;
491+ delete[] info_.extensions_ ;
500492}
501493
502494bool Device::ValidateComgr () {
@@ -789,12 +781,8 @@ ClBinary::ClBinary(const amd::Device& dev, BinaryImageFormat bifVer)
789781ClBinary::~ClBinary () {
790782 release ();
791783
792- if (elfIn_) {
793- delete elfIn_;
794- }
795- if (elfOut_) {
796- delete elfOut_;
797- }
784+ delete elfIn_;
785+ delete elfOut_;
798786}
799787
800788bool ClBinary::setElfTarget () {
@@ -1072,10 +1060,8 @@ bool ClBinary::setElfIn() {
10721060 }
10731061 elfIn_ = new amd::Elf (ELFCLASSNONE, binary_, size_, nullptr , amd::Elf::ELF_C_READ);
10741062 if ((elfIn_ == nullptr ) || !elfIn_->isSuccessful ()) {
1075- if (elfIn_) {
1076- delete elfIn_;
1077- elfIn_ = nullptr ;
1078- }
1063+ delete elfIn_;
1064+ elfIn_ = nullptr ;
10791065 LogError (" Creating input ELF object failed" );
10801066 return false ;
10811067 }
@@ -1084,20 +1070,16 @@ bool ClBinary::setElfIn() {
10841070}
10851071
10861072void ClBinary::resetElfIn () {
1087- if (elfIn_) {
1088- delete elfIn_;
1089- elfIn_ = nullptr ;
1090- }
1073+ delete elfIn_;
1074+ elfIn_ = nullptr ;
10911075}
10921076
10931077bool ClBinary::setElfOut (unsigned char eclass,
10941078 const char * outFile, bool tempFile) {
10951079 elfOut_ = new amd::Elf (eclass, nullptr , 0 , outFile, amd::Elf::ELF_C_WRITE);
10961080 if ((elfOut_ == nullptr ) || !elfOut_->isSuccessful ()) {
1097- if (elfOut_) {
1098- delete elfOut_;
1099- elfOut_ = nullptr ;
1100- }
1081+ delete elfOut_;
1082+ elfOut_ = nullptr ;
11011083 LogError (" Creating ouput ELF object failed" );
11021084 return false ;
11031085 }
@@ -1109,10 +1091,8 @@ bool ClBinary::setElfOut(unsigned char eclass,
11091091}
11101092
11111093void ClBinary::resetElfOut () {
1112- if (elfOut_) {
1113- delete elfOut_;
1114- elfOut_ = nullptr ;
1115- }
1094+ delete elfOut_;
1095+ elfOut_ = nullptr ;
11161096}
11171097
11181098bool ClBinary::loadLlvmBinary (std::string& llvmBinary,
0 commit comments