Skip to content
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

Missing member initialisation added and Pointer check before usage added #292

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 DeviceIdentification/DeviceIdentification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ namespace Plugin {
}
}
#else
ASSERT(_service != nullptr);
// extract DeviceId set by Thunder
if (_service->SubSystems()->IsActive(PluginHost::ISubSystem::IDENTIFIER) == true) {

Expand All @@ -180,6 +181,7 @@ namespace Plugin {

void DeviceIdentification::Info(JsonData::DeviceIdentification::DeviceidentificationData& deviceInfo) const
{
ASSERT(_identifier != nullptr);
deviceInfo.Firmwareversion = _identifier->FirmwareVersion();
deviceInfo.Chipset = _identifier->Chipset();

Expand Down
19 changes: 14 additions & 5 deletions DeviceInfo/DeviceInfoJsonRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,10 @@ namespace Plugin {
{
uint32_t result = Core::ERROR_NONE;
string serialNumber;
result = _deviceInfo->SerialNumber(serialNumber);
ASSERT(_deviceInfo != nullptr);
result = _deviceInfo->SerialNumber(serialNumber);

response.Serialnumber = serialNumber;
response.Serialnumber = serialNumber;
return result;
}

Expand All @@ -259,7 +260,8 @@ namespace Plugin {
uint32_t DeviceInfo::endpoint_get_modelid(ModelidData& response) const
{
string sku;
uint32_t result = _deviceInfo->Sku(sku);
ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->Sku(sku);
if (result == Core::ERROR_NONE) {
Core::EnumerateType<JsonData::DeviceInfo::ModelidData::SkuType> value(sku.c_str(), false);
if (value.IsSet()) {
Expand All @@ -279,7 +281,8 @@ namespace Plugin {
// - ERROR_GENERAL:
uint32_t DeviceInfo::endpoint_get_make(MakeData& response) const
{
string make;
string make;
ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->Make(make);
if (result == Core::ERROR_NONE) {
Core::EnumerateType<JsonData::DeviceInfo::MakeData::MakeType> value(make.c_str(), false);
Expand All @@ -300,6 +303,7 @@ namespace Plugin {
uint32_t DeviceInfo::endpoint_get_modelname(ModelnameData& response) const
{
string modelName;
ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->ModelName(modelName);

response.Model = modelName;
Expand All @@ -313,8 +317,9 @@ namespace Plugin {
uint32_t DeviceInfo::endpoint_get_modelyear(ModelyearData& response) const
{
uint16_t year;
ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->ModelYear(year);
response.Year = year;
response.Year = year;

return result;
}
Expand All @@ -326,6 +331,7 @@ namespace Plugin {
uint32_t DeviceInfo::endpoint_get_friendlyname(FriendlynameInfo& response) const
{
string name;
ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->FriendlyName(name);
response.Name = name;

Expand All @@ -339,6 +345,7 @@ namespace Plugin {
uint32_t DeviceInfo::endpoint_get_platformname(FriendlynameInfo& response) const
{
string name;
ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->PlatformName(name);
response.Name = name;

Expand All @@ -353,6 +360,7 @@ namespace Plugin {
{
string deviceType;

ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->DeviceType(deviceType);
if (result == Core::ERROR_NONE) {
Core::EnumerateType<JsonData::DeviceInfo::DevicetypeData::DevicetypeType> value(deviceType.c_str(), false);
Expand All @@ -375,6 +383,7 @@ namespace Plugin {
{
string distributorId;

ASSERT(_deviceInfo != nullptr);
uint32_t result = _deviceInfo->DistributorId(distributorId);
if (result == Core::ERROR_NONE) {
Core::EnumerateType<JsonData::DeviceInfo::DistributoridData::DistributoridType> value(distributorId.c_str(), false);
Expand Down
12 changes: 6 additions & 6 deletions DisplayInfo/DeviceSettings/Amlogic/SoC_abstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static void getPrimaryPlane(int drm_fd, kms_ctx *kms, drmModePlane **plane)
kms_get_plane(drm_fd, kms);
cout << "Primary Plane ID : "<< kms->primary_plane_id << endl;
*plane = drmModeGetPlane(drm_fd, kms->primary_plane_id );
if(*plane)
if (*plane)
printf("fb id : %d\n", (*plane)->fb_id);
}

Expand All @@ -113,21 +113,21 @@ static void getGraphicSize(uint32_t &w, uint32_t &h)

/* Setup KMS */
kms = kms_setup(drm_fd);
if(!kms || !kms->crtc ) {
if (!kms || !kms->crtc) {
cout << "[Amlogic] kms_setup fail" << endl;
break;
}

/* Get primary buffer */
getPrimaryPlane(drm_fd, kms, &plane);
if( !plane) {
if (!plane) {
cout << "[Amlogic] fail to getPrimaryPlane" << endl;
break;
}

/* get fb */
drmModeFB *fb = drmModeGetFB(drm_fd, plane->fb_id);
while(!fb) {
while (!fb) {
getPrimaryPlane(drm_fd, kms, &plane);
fb = drmModeGetFB(drm_fd, plane->fb_id);
if (trytimes++ > 100) {
Expand All @@ -137,7 +137,7 @@ static void getGraphicSize(uint32_t &w, uint32_t &h)
}

/* Get the width and height */
if(fb) {
if (fb) {
w = fb->width;
h = fb->height;
drmModeFreeFB(fb);
Expand All @@ -146,7 +146,7 @@ static void getGraphicSize(uint32_t &w, uint32_t &h)

/* release */
/* Cleanup buffer info */
if(kms) {
if (kms) {
kms_cleanup_context(kms);
free(kms);
}
Expand Down
Loading
Loading