Skip to content

Commit

Permalink
YogaSMC: Fix warning from Clang analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen-zen committed Sep 3, 2020
1 parent b36aabd commit c5ced60
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions YogaSMC/YogaSMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ bool YogaSMC::notificationHandler(void *refCon, IOService *newService, IONotifie
YogaSMC* YogaSMC::withDevice(IOService *provider, IOACPIPlatformDevice *device) {
YogaSMC* dev = OSTypeAlloc(YogaSMC);

OSDictionary* dictionary = OSDictionary::withCapacity(1);
OSDictionary *dictionary = OSDictionary::withCapacity(1);
OSDictionary *sensors = OSDictionary::withDictionary(OSDynamicCast(OSDictionary, provider->getProperty("Sensors")));
dictionary->setObject("Sensors", sensors);

dev->ec = device;

Expand All @@ -227,7 +229,8 @@ YogaSMC* YogaSMC::withDevice(IOService *provider, IOACPIPlatformDevice *device)
OSSafeReleaseNULL(dev);
}

dev->conf = OSDynamicCast(OSDictionary, provider->getProperty("Sensors"));
dev->conf = sensors;
sensors->release();
dictionary->release();
return dev;
}
Expand Down
7 changes: 5 additions & 2 deletions YogaSMC/YogaSMC/IdeaSMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ OSDefineMetaClassAndStructors(IdeaSMC, YogaSMC);
IdeaSMC* IdeaSMC::withDevice(IOService *provider, IOACPIPlatformDevice *device) {
IdeaSMC* dev = OSTypeAlloc(IdeaSMC);

OSDictionary* dictionary = OSDictionary::withCapacity(1);
OSDictionary *dictionary = OSDictionary::withCapacity(1);
OSDictionary *sensors = OSDictionary::withDictionary(OSDynamicCast(OSDictionary, provider->getProperty("Sensors")));
dictionary->setObject("Sensors", sensors);

dev->ec = device;

Expand All @@ -22,7 +24,8 @@ IdeaSMC* IdeaSMC::withDevice(IOService *provider, IOACPIPlatformDevice *device)
OSSafeReleaseNULL(dev);
}

dev->conf = OSDynamicCast(OSDictionary, provider->getProperty("Sensors"));
dev->conf = sensors;
sensors->release();
dictionary->release();
return dev;
}
Expand Down
7 changes: 5 additions & 2 deletions YogaSMC/YogaSMC/ThinkSMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ OSDefineMetaClassAndStructors(ThinkSMC, YogaSMC);
ThinkSMC* ThinkSMC::withDevice(IOService *provider, IOACPIPlatformDevice *device) {
ThinkSMC* dev = OSTypeAlloc(ThinkSMC);

OSDictionary* dictionary = OSDictionary::withCapacity(1);
OSDictionary *dictionary = OSDictionary::withCapacity(1);
OSDictionary *sensors = OSDictionary::withDictionary(OSDynamicCast(OSDictionary, provider->getProperty("Sensors")));
dictionary->setObject("Sensors", sensors);

dev->ec = device;

Expand All @@ -23,7 +25,8 @@ ThinkSMC* ThinkSMC::withDevice(IOService *provider, IOACPIPlatformDevice *device
OSSafeReleaseNULL(dev);
}

dev->conf = OSDynamicCast(OSDictionary, provider->getProperty("Sensors"));
dev->conf = sensors;
sensors->release();
dictionary->release();
return dev;
}
Expand Down
2 changes: 2 additions & 0 deletions YogaSMC/YogaVPC/ThinkVPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,9 @@ bool ThinkVPC::setBacklight(UInt32 level) {
}

bool ThinkVPC::setSSTStatus(UInt32 value) {
#ifdef DEBUG
char const *property[5] = {"Indicator off", "Working", "Waking", "Sleeping", "Hibernating"};
#endif
if (vpc->validateObject("CSSI") == kIOReturnSuccess) {
OSObject* params[] = {
OSNumber::withNumber(value, 32)
Expand Down

0 comments on commit c5ced60

Please sign in to comment.