avoid 'may be used unitialized' warnings

gcc : -Wmaybe-uninitialized or -Wuninitialized
This commit is contained in:
Tore Fuglestad 2022-05-12 08:27:07 +02:00
parent 703a6e08d6
commit e604e98446
2 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ ec_adaptert * oshw_find_adapters(void)
int i;
struct if_nameindex *ids;
ec_adaptert * adapter;
ec_adaptert * prev_adapter;
ec_adaptert * prev_adapter = NULL;
ec_adaptert * ret_adapter = NULL;
@ -60,7 +60,7 @@ ec_adaptert * oshw_find_adapters(void)
* adapter.
* Else save as pointer to return.
*/
if (i)
if (prev_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;
buffersize = *psize;
rxfragmentno = 0;
rxframeno = 0xff;
rxframeoffset = 0;
/* Hang for a while if nothing is in */
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)
{
rxframeoffset = 0;
rxframeno = EOE_HDR_FRAME_NO_GET(frameinfo2);
rxframesize = (EOE_HDR_FRAME_OFFSET_GET(frameinfo2) << 5);
if (rxframesize > buffersize)