Skip to content

Commit 5062107

Browse files
committed
nvm_flash_log: fix from cppcheck
1 parent 56e06bc commit 5062107

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/wh_nvm_flash_log.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ static int nfl_PartitionWrite(whNvmFlashLogContext* ctx, uint32_t partition)
182182

183183
static int nfl_PartitionCommit(whNvmFlashLogContext* ctx, uint32_t partition)
184184
{
185-
const whFlashCb* f_cb = ctx->flash_cb;
185+
const whFlashCb* f_cb;
186186
uint32_t off;
187187
int ret;
188188

189189
if (ctx == NULL || partition > 1)
190190
return WH_ERROR_BADARGS;
191191

192192
off = partition * ctx->partition_size;
193-
193+
f_cb = ctx->flash_cb;
194194
ret = f_cb->BlankCheck(ctx->flash_ctx, off,
195195
sizeof(whNvmFlashLogPartitionHeader));
196196
if (ret != 0)
@@ -207,7 +207,7 @@ static int nfl_PartitionCommit(whNvmFlashLogContext* ctx, uint32_t partition)
207207
static int nfl_PartitionChoose(whNvmFlashLogContext* ctx)
208208
{
209209
whNvmFlashLogPartitionHeader header0, header1;
210-
const whFlashCb* f_cb = ctx->flash_cb;
210+
const whFlashCb* f_cb;
211211
uint32_t part1_offset;
212212
int part0_blank, part1_blank;
213213
int ret;
@@ -216,7 +216,7 @@ static int nfl_PartitionChoose(whNvmFlashLogContext* ctx)
216216
return WH_ERROR_BADARGS;
217217

218218
part1_offset = ctx->partition_size;
219-
219+
f_cb = ctx->flash_cb;
220220
ret = f_cb->BlankCheck(ctx->flash_ctx, 0, sizeof(header0));
221221
if (ret != 0 && ret != WH_ERROR_NOTBLANK) {
222222
return ret;

0 commit comments

Comments
 (0)