diff --git a/common/include/daudio_log.h b/common/include/daudio_log.h index 7e98f0b229a6d42cb490c5b5bf5edeaba5e10b6f..3d597a233fbfecff3e3ef978a93e6f0bfa66b7af 100644 --- a/common/include/daudio_log.h +++ b/common/include/daudio_log.h @@ -40,19 +40,19 @@ void DHLog(DHLogLevel logLevel, const char *fmt, ...); (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) #define CHECK_NULL_VOID(ptr) \ - do { \ - if (ptr == nullptr) { \ - DHLOGE("Address pointer is null");\ - return; \ - } \ + do { \ + if ((ptr) == nullptr) { \ + DHLOGE("Address pointer is null"); \ + return; \ + } \ } while (0) -#define CHECK_NULL_RETURN(ptr, ret) \ - do { \ - if (ptr == nullptr) { \ - DHLOGE("Address pointer is null");\ - return ret; \ - } \ +#define CHECK_NULL_RETURN(ptr, ret) \ + do { \ + if ((ptr) == nullptr) { \ + DHLOGE("Address pointer is null"); \ + return (ret); \ + } \ } while (0) } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiomanager/managersource/src/daudio_source_dev.cpp b/services/audiomanager/managersource/src/daudio_source_dev.cpp index 5e434236271b50bc18b51f865b4fba44e4302a51..ceb0c6b2b96fbc6bfe79cd1f736a0dbc50ce775b 100644 --- a/services/audiomanager/managersource/src/daudio_source_dev.cpp +++ b/services/audiomanager/managersource/src/daudio_source_dev.cpp @@ -658,7 +658,6 @@ int32_t DAudioSourceDev::TaskOpenDSpeaker(const std::string &args) return ERR_DH_AUDIO_FAILED; } auto speaker = FindIoDevImpl(args); - if (speaker == nullptr) { DHLOGE("The IO device is invaild."); NotifyHDF(NOTIFY_OPEN_SPEAKER_RESULT, HDF_EVENT_RESULT_FAILED, dhId);