Skip to content

Commit a8740c2

Browse files
raiden00plxiaoxiang781216
authored andcommitted
logging/nxscope: fix various warnings reported by CodeChekcer
fix various warnings reported by CodeChekcer for nxscope Signed-off-by: raiden00pl <[email protected]>
1 parent 877e491 commit a8740c2

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

include/logging/nxscope/nxscope_chan.h

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
#include <fixedmath.h>
3333

34-
#include <logging/nxscope/nxscope.h>
35-
3634
/****************************************************************************
3735
* Public Types
3836
****************************************************************************/

logging/nxscope/nxscope.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ int nxscope_recv(FAR struct nxscope_s *s)
11201120

11211121
/* Handle frame */
11221122

1123-
ret = nxscope_recv_handle(s, frame.id, frame.dlen, frame.data);
1123+
ret = nxscope_recv_handle(s, frame.id, (uint16_t)frame.dlen, frame.data);
11241124
if (ret < 0)
11251125
{
11261126
_err("ERROR: nxscope_recv_handle failed %d\n", ret);

logging/nxscope/nxscope_chan.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@ int nxscope_chan_div(FAR struct nxscope_s *s, uint8_t ch, uint8_t div)
683683

684684
int nxscope_chan_all_en(FAR struct nxscope_s *s, bool en)
685685
{
686-
int ret = OK;
687-
int i = 0;
686+
int ret = OK;
687+
uint8_t i = 0;
688688

689689
DEBUGASSERT(s);
690690

logging/nxscope/nxscope_pser.c

+10
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ static int nxscope_frame_get(FAR struct nxscope_proto_s *p,
166166
}
167167
}
168168

169+
/* Check for no header */
170+
171+
if (hdr == NULL)
172+
{
173+
ret = -EINVAL;
174+
goto errout;
175+
}
176+
177+
/* Check for no SOF in header */
178+
169179
if (hdr->sof != NXSCOPE_HDR_SOF)
170180
{
171181
ret = -EINVAL;

0 commit comments

Comments
 (0)