Merge pull request #614 from notofug/avoid_warnings

avoid 'maybe used unitialized' warnings
This commit is contained in:
nakarlsson 2022-06-16 07:34:04 +02:00 committed by GitHub
commit 0b8f888f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ ec_adaptert * oshw_find_adapters(void)
int i; int i;
struct if_nameindex *ids; struct if_nameindex *ids;
ec_adaptert * adapter; ec_adaptert * adapter;
ec_adaptert * prev_adapter; ec_adaptert * prev_adapter = NULL;
ec_adaptert * ret_adapter = NULL; ec_adaptert * ret_adapter = NULL;
@ -60,7 +60,7 @@ ec_adaptert * oshw_find_adapters(void)
* adapter. * adapter.
* Else save as pointer to return. * Else save as pointer to return.
*/ */
if (i) if (prev_adapter)
{ {
prev_adapter->next = adapter; prev_adapter->next = adapter;
} }

View File

@ -420,6 +420,8 @@ int ecx_EOErecv(ecx_contextt *context, uint16 slave, uint8 port, int * psize, vo
NotLast = TRUE; NotLast = TRUE;
buffersize = *psize; buffersize = *psize;
rxfragmentno = 0; rxfragmentno = 0;
rxframeno = 0xff;
rxframeoffset = 0;
/* Hang for a while if nothing is in */ /* Hang for a while if nothing is in */
wkc = ecx_mbxreceive(context, slave, (ec_mbxbuft *)&MbxIn, timeout); wkc = ecx_mbxreceive(context, slave, (ec_mbxbuft *)&MbxIn, timeout);
@ -446,7 +448,6 @@ int ecx_EOErecv(ecx_contextt *context, uint16 slave, uint8 port, int * psize, vo
if (rxfragmentno == 0) if (rxfragmentno == 0)
{ {
rxframeoffset = 0;
rxframeno = EOE_HDR_FRAME_NO_GET(frameinfo2); rxframeno = EOE_HDR_FRAME_NO_GET(frameinfo2);
rxframesize = (EOE_HDR_FRAME_OFFSET_GET(frameinfo2) << 5); rxframesize = (EOE_HDR_FRAME_OFFSET_GET(frameinfo2) << 5);
if (rxframesize > buffersize) if (rxframesize > buffersize)