Skip to content

Commit

Permalink
hw/char: fsl-linflex: Fix build error
Browse files Browse the repository at this point in the history
Fix the following build error when compiling fsl-linflex.c:

  error: ‘r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Signed-off-by: Bin Meng <bin.meng@windriver.com>
  • Loading branch information
lbmeng authored and ho28 committed Sep 4, 2024
1 parent 9ada609 commit f7e1cca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hw/char/fsl-linflex.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void fsl_linflex_write(void *opaque, hwaddr offset,
}
}

static uint64_t fsl_linflex_read(void *opaque, hwaddr offset,
static uint64_t fsl_linflex_read(void *opaque, hwaddr offset,
unsigned size)
{
FslLinflexState *s = opaque;
Expand Down Expand Up @@ -169,6 +169,7 @@ static uint64_t fsl_linflex_read(void *opaque, hwaddr offset,
break;
default:
// todo: maybe log invalid reg read
r = 0;
break;
}
return r;
Expand All @@ -193,7 +194,7 @@ static void fsl_linflex_rx(void *opaque, const uint8_t *buf, int size)
static int fsl_linflex_can_rx(void *opaque)
{
FslLinflexState *s = opaque;

// check status register, if can receive then return 1 else 0
if ((s->regs[LINFLEX_UARTSR] & UARTSR_DRFRFE) ||
(s->regs[LINFLEX_UARTSR] & UARTSR_RMB) ) {
Expand Down

0 comments on commit f7e1cca

Please sign in to comment.