Code alarm cleaning

Signed-off-by: yinshuqing <yinshuqing@huawei.com>
This commit is contained in:
yinshuqing
2022-01-18 15:30:54 +08:00
parent c297152ecb
commit bb1644ff41
21 changed files with 41 additions and 37 deletions
@@ -427,7 +427,7 @@ static int32_t HdfDevListenerThreadStart(struct HdfDevListenerThread *thread)
}
do {
for (int i = 0; i < thread->pfdSize; i++) {
for (uint16_t i = 0; i < thread->pfdSize; i++) {
if (thread->pfds[i].fd == SYSCALL_INVALID_FD) {
continue;
}
@@ -597,7 +597,7 @@ static void HdfDevListenerThreadDestroy(struct HdfDevListenerThread *thread)
thread->adapterListPtr = NULL;
thread->listenerListPtr = NULL;
OsalMutexUnlock(&thread->mutex);
for (int i = 0; i < thread->pfdSize; i++) {
for (uint16_t i = 0; i < thread->pfdSize; i++) {
if (thread->pfds[i].fd != SYSCALL_INVALID_FD &&
HdfAdapterExitListenIoctl(thread->pfds[i].fd) == HDF_SUCCESS) {
stopCount++;
+1 -1
View File
@@ -284,7 +284,7 @@ static int HdfVNodeAdapterReadDevEvent(struct HdfVNodeAdapterClient *client, uns
return HDF_ERR_IO;
}
bwr.readConsumed = eventSize;
bwr.cmdCode = event->id;
bwr.cmdCode = (int32_t)event->id;
}
if (CopyToUser(bwrUser, &bwr, sizeof(struct HdfWriteReadBuf)) != 0) {
-1
View File
@@ -71,7 +71,6 @@ static int32_t DacManagerAddDevice(struct DacDevice *device)
ret = HDF_FAILURE;
} else {
manager->devices[device->devNum] = device;
HDF_LOGE("%s: device:%p", __func__, manager->devices[0]);
ret = HDF_SUCCESS;
}
+3 -3
View File
@@ -139,7 +139,7 @@ static int32_t PlatformEventRead(struct PlatformEvent *pe, uint32_t *events, uin
return HDF_ERR_INVALID_PARAM;
}
PlatformEventLock(pe);
if (((uint32_t)mode & PLAT_EVENT_MODE_AND) == 0) {
if (((uint32_t)mode & (uint32_t)PLAT_EVENT_MODE_AND) == 0) {
if ((pe->eventsWord & mask) != 0) {
masked = pe->eventsWord & mask;
}
@@ -162,7 +162,7 @@ static int32_t PlatformEventReadSlowlly(struct PlatformEvent *pe,
struct PlatformEventWaiter waiter;
waiter.mask = mask;
waiter.mode = (uint32_t)mode & (~PLAT_EVENT_MODE_ASYNC);
waiter.mode = (uint32_t)mode & (uint32_t)(~PLAT_EVENT_MODE_ASYNC);
(void)OsalSemInit(&waiter.sem, 0);
DListHeadInit(&waiter.node);
@@ -225,7 +225,7 @@ static int32_t PlatformEventAsyncCallback(struct PlatformEventWaiter *waiter, in
}
// gona do it in thread context later ...
return listener->cb(listener, (int32_t)events & listener->mask);
return listener->cb(listener, (uint32_t)events & listener->mask);
}
int32_t PlatformEventListen(struct PlatformEvent *pe, const struct PlatformEventListener *listener)
+1 -1
View File
@@ -281,7 +281,7 @@ static bool PlatformDeviceMatchByNumber(struct PlatformDevice *device, void *dat
{
uint32_t number = (uint32_t)(uintptr_t)data;
return (device != NULL && device->number == number);
return (device != NULL && (uint32_t)device->number == number);
}
struct PlatformDevice *PlatformManagerGetDeviceByNumber(struct PlatformManager *manager, uint32_t number)
+1 -1
View File
@@ -298,7 +298,7 @@ static int32_t HdmiCntlrInit(struct HdmiCntlr *cntlr)
cntlr->service.Dispatch = HdmiIoDispatch;
cntlr->hdfDevObj->service = &(cntlr->service);
cntlr->device.number = cntlr->deviceIndex;
cntlr->device.number = (int32_t)cntlr->deviceIndex;
cntlr->device.hdfDev = cntlr->hdfDevObj;
HdmiInfoFrameInit(cntlr);
HdmiDdcInit(cntlr);
+2 -2
View File
@@ -166,7 +166,7 @@ static void HdmiDfmCaculateVideoBorrowInfo(struct HdmiDfmInfo *info)
if (info->activeTimeRef >= info->activeTimeMin && info->blankTimeRef >= info->blankTimeMin) {
info->tBorrow = 0;
} else if (info->activeTimeRef < info->activeTimeMin && info->blankTimeRef >= info->blankTimeMin) {
info->tBorrow = info->activeTimeMin - info->activeTimeRef;
info->tBorrow = (int32_t)(info->activeTimeMin - info->activeTimeRef);
} else {
info->tBorrow = HDMI_DFM_INVALID_VAL;
}
@@ -244,7 +244,7 @@ static void HdmiDfmCaculateVideoInfo(struct HdmiDfmInfo *info, struct HdmiDfmPar
return;
}
info->utilization = (uint64_t)info->cFrlActualPayload * 100000 / (uint64_t)info->minFrlCharsPerLine;
info->margin = 100000 - (info->utilization + info->overheadMax);
info->margin = (int32_t)(100000 - (info->utilization + info->overheadMax));
}
static void HdmiDfmFillInfo(struct HdmiDfmInfo *info, struct HdmiDfmParam *param)
+2 -2
View File
@@ -107,7 +107,7 @@ static int32_t HdmiEdidVendorInfoPhase(struct HdmiEdid *edid)
/* Serial Number */
for (i = 0; i < HDMI_EDID_SERIAL_NUMBER_FIELD_LEN; i++) {
sinkCap->vendorInfo.serialNumber |= (block->serialNumber[i] << (HDMI_EDID_SERIAL_NUMBER_SHIFT * i));
sinkCap->vendorInfo.serialNumber |= (block->serialNumber[i] << (uint16_t)(HDMI_EDID_SERIAL_NUMBER_SHIFT * i));
}
sinkCap->vendorInfo.week = block->week;
sinkCap->vendorInfo.year = block->year + HDMI_EDID_YEAR_BASE;
@@ -177,7 +177,7 @@ static int32_t HdmiEdidEstablisedTimingPhase(struct HdmiEdid *edid)
struct HdmiEdidFirstBlockInfo *block = (struct HdmiEdidFirstBlockInfo *)edid->raw;
for (i = 0; i < HDMI_EDID_ESTABLISHED_TIMINGS_FIELD_LEN; i++) {
data |= (block->estTimings[i] << (i * HDMI_ONE_BYTE_SHIFT));
data |= (block->estTimings[i] << (uint32_t)(i * HDMI_ONE_BYTE_SHIFT));
}
/*
+1 -1
View File
@@ -240,7 +240,7 @@ static int32_t I2cTransferRebuildMsgs(struct HdfSBuf *data, struct I2cMsg **ppms
return HDF_ERR_IO;
}
count = len / sizeof(*msgs);
count = (int16_t)len / (int16_t)sizeof(*msgs);
PLAT_LOGV("I2cTransferRebuildMsgs: count:%u, len:%u, sizeof(*msgs):%u",
count, len, sizeof(*msgs));
for (i = 0; i < count; i++) {
+3 -3
View File
@@ -95,7 +95,7 @@ static int32_t GetAddrStatus(struct I3cCntlr *cntlr, uint16_t addr)
static int32_t SetAddrStatus(struct I3cCntlr *cntlr, uint16_t addr, enum I3cAddrStatus status)
{
uint16_t temp;
uint32_t ret;
int32_t ret;
uint16_t statusMask;
if (addr > I3C_ADDR_MAX) {
@@ -115,7 +115,7 @@ static int32_t SetAddrStatus(struct I3cCntlr *cntlr, uint16_t addr, enum I3cAddr
}
statusMask = ADDR_STATUS_MASK << ((addr % ADDRS_PER_UINT16) * ADDRS_STATUS_BITS);
temp = (cntlr->addrSlot[addr / ADDRS_PER_UINT16]) & ~statusMask;
temp = (cntlr->addrSlot[addr / (uint16_t)ADDRS_PER_UINT16]) & ~statusMask;
temp |= ((uint16_t)status) << ((addr % ADDRS_PER_UINT16) * ADDRS_STATUS_BITS);
cntlr->addrSlot[addr / ADDRS_PER_UINT16] = temp;
@@ -546,7 +546,7 @@ int32_t I3cCntlrGetConfig(struct I3cCntlr *cntlr, struct I3cConfig *config)
}
ret = cntlr->ops->getConfig(cntlr, config);
config = &cntlr->config;
cntlr->config = *config;
I3cCntlrUnlock(cntlr);
return ret;
+1 -1
View File
@@ -37,7 +37,7 @@ static int32_t PcieCntlrInit(struct PcieCntlr *cntlr)
cntlr->service.Dispatch = PcieIoDispatch;
cntlr->hdfDevObj->service = &(cntlr->service);
cntlr->device.number = cntlr->devInfo.busNum;
cntlr->device.number = (int32_t)cntlr->devInfo.busNum;
cntlr->device.hdfDev = cntlr->hdfDevObj;
return HDF_SUCCESS;
}
+4 -3
View File
@@ -82,7 +82,7 @@ struct PinDesc *PinCntlrGetPinDescByName(const char *pinName)
struct DListHead *head = NULL;
struct PinCntlr *cntlr = NULL;
struct PinCntlr *tmp = NULL;
int32_t num;
uint16_t num;
if (pinName == NULL) {
HDF_LOGE("%s: pinName is NULL!", __func__);
@@ -153,7 +153,8 @@ struct PinCntlr *PinCntlrGetByPin(struct PinDesc *desc)
static int32_t GetPinIndex(struct PinCntlr *cntlr, struct PinDesc *desc)
{
int32_t index, ret;
uint16_t index;
int32_t ret;
for (index = 0; index < cntlr->pinCount; index++) {
if (cntlr->pins[index].pinName == NULL) {
@@ -163,7 +164,7 @@ static int32_t GetPinIndex(struct PinCntlr *cntlr, struct PinDesc *desc)
ret = strcmp(cntlr->pins[index].pinName, desc->pinName);
if (ret == 0) {
HDF_LOGI("%s: get pin index:%d success!", __func__, index);
return index;
return (int32_t)index;
}
}
HDF_LOGE("%s: get pin index failed!", __func__);
+1 -1
View File
@@ -155,7 +155,7 @@ static int32_t UartUserReceive(DevHandle handle, void *data, uint32_t size, enum
goto __EXIT;
}
if (cmd == UART_IO_READ) {
ret = rLen;
ret = (int32_t)rLen;
}
__EXIT:
HdfSBufRecycle(reply);
+1 -1
View File
@@ -117,7 +117,7 @@ static int DacTestThreadFunc(void *param)
{
struct DacTester *tester = NULL;
uint32_t val;
int i;
uint32_t i;
int32_t ret;
tester = DacTesterGet();
if (tester == NULL) {
+4 -4
View File
@@ -130,7 +130,7 @@ static int32_t I2sPlayTest(struct I2sTest *test)
return HDF_FAILURE;
}
uint32_t totalLen = 0;
int32_t totalLen = 0;
uint32_t readBuff = I2S_WRITE_BUFF_SIZE;
do {
size = OsalFileRead(&file, test->wbuf, readBuff);
@@ -143,7 +143,7 @@ static int32_t I2sPlayTest(struct I2sTest *test)
HDF_LOGE("%s: I2sPlayTest error", __func__);
return HDF_FAILURE;
}
printf("[%s] [%d] I2sPlayTest wlen[%d]\n", __func__, ret, wlen);
printf("[%s] [%d] I2sPlayTest wlen[%u]\n", __func__, ret, wlen);
}
} while (size > 0);
@@ -255,7 +255,7 @@ static int32_t I2sReadStartTest(struct I2sTest *test)
HDF_LOGE("%s: test null", __func__);
return HDF_ERR_INVALID_OBJECT;
}
HDF_LOGI("%s: rbuf[%p] wbuf[%p]\n", __func__, test->rbuf, test->wbuf);
I2sStartRead(test->handle);
if (test->rbuf != NULL) {
HDF_LOGI("%s: rbuf[0] = [%u]\n", __func__, test->rbuf[0]);
@@ -281,7 +281,7 @@ static int32_t I2sReadStopTest(struct I2sTest *test)
HDF_LOGE("%s: test null", __func__);
return HDF_ERR_INVALID_OBJECT;
}
HDF_LOGI("%s: rbuf[%p] wbuf[%p]\n", __func__, test->rbuf, test->wbuf);
I2sStopRead(test->handle);
if (test->rbuf != NULL) {
HDF_LOGI("%s: rbuf[0] = [%u]\n", __func__, test->rbuf[0]);
+1 -1
View File
@@ -60,7 +60,7 @@ static struct SpiCfg g_spiCfg = {
static int32_t SpiCmpMemByBits(uint8_t *wbuf, uint8_t *rbuf, uint32_t len, uint8_t bits)
{
int32_t i;
uint32_t i;
uint16_t vw;
uint16_t vr;
+5 -1
View File
@@ -73,7 +73,11 @@ static int32_t TimerGetTest(struct TimerTest *test)
uint32_t uSecond;
bool isPeriod;
TimerGet(test->handle, &uSecond, &isPeriod);
if (TimerGet(test->handle, &uSecond, &isPeriod) != HDF_SUCCESS) {
HDF_LOGE("func: %s, TimerGet dailed", __func__);
return HDF_FAILURE;
}
HDF_LOGD("%s:[%d][%d]", __func__, uSecond, isPeriod);
return HDF_SUCCESS;
}
+1 -1
View File
@@ -236,7 +236,7 @@ static int32_t UartTestBind(struct HdfDeviceObject *device)
static int32_t UartTestInitFromHcs(struct UartTest *test, const struct DeviceResourceNode *node)
{
int32_t ret;
int32_t i;
uint32_t i;
uint32_t *tmp = NULL;
struct DeviceResourceIface *face = NULL;
+1 -1
View File
@@ -354,7 +354,7 @@ static int32_t VirtualI3cParseAndInit(struct HdfDeviceObject *device, const stru
VirtualI3cCntlrInit(virtual);
virtual->cntlr.priv = (void *)node;
virtual->cntlr.busId = virtual->busId;
virtual->cntlr.busId = (int16_t)virtual->busId;
virtual->cntlr.ops = &g_method;
(void)OsalSpinInit(&virtual->spin);
ret = I3cCntlrAdd(&virtual->cntlr);
@@ -36,10 +36,10 @@ static struct regulator_consumer_supply g_virtualCurrentRegulatorSupplies[] = {
// virtual regulator init info
static struct regulator_init_data g_virtualCurrentRegulatorInitData = {
.constraints = {
.name = "virtual_current_regulator",
.min_uA = MINIMUN_CURRENT,
.max_uA = MAXIMUN_CURRENT,
.valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
.name = "virtual_current_regulator",
.min_uA = MINIMUN_CURRENT,
.max_uA = MAXIMUN_CURRENT,
.valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(g_virtualCurrentRegulatorSupplies),
.consumer_supplies = g_virtualCurrentRegulatorSupplies,
@@ -194,7 +194,7 @@ int VirtualVoltageRegulatorAdapterInit(void)
{
HDF_LOGI("VirtualVoltageRegulatorAdapterInit");
int ret = platform_device_register(&g_virtualVoltageRegulatorPlatformDevice);
if(ret == 0) {
if (ret == 0) {
ret = platform_driver_register(&g_virtualVoltageRegulatorPlatformDriver);
} else {
HDF_LOGE("VirtualVoltageRegulatorAdapterInit:device register fail %d", ret);
@@ -206,7 +206,7 @@ static int __init VirtualVoltageRegulatorInit(void)
{
HDF_LOGI("VirtualVoltageRegulatorInit");
int ret = platform_device_register(&g_virtualVoltageRegulatorPlatformDevice);
if(ret == 0) {
if (ret == 0) {
ret = platform_driver_register(&g_virtualVoltageRegulatorPlatformDriver);
}
return ret;