Skip to content

Commit

Permalink
fix potential error from type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
justapotato213 committed Nov 4, 2024
1 parent 159c03f commit 1662687
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions boards/arm/rp2040/common/src/rp2040_spisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,14 @@ typedef struct {
} partition_state_t;

static void partition_handler(struct partition_s *part, void *arg) {
unsigned partition = *(int *)arg;

partition_state_t *partition_handler_state = (partition_state_t *)arg;

char devname[] = "/dev/mmcsd0p0";

if (partition < 10 && part->index == partition_handler_state->partition_num) {
if (partition_handler_state->partition_num < 10 &&
part->index == partition_handler_state->partition_num) {
finfo("Num of sectors: %d \n", part->nblocks);
devname[sizeof(devname) - 2] = partition + 48;
devname[sizeof(devname) - 2] = partition_handler_state->partition_num + 48;
register_blockpartition(devname, 0, "/dev/mmcsd0", part->firstblock,
part->nblocks);
partition_handler_state->err = 0;
Expand Down

0 comments on commit 1662687

Please sign in to comment.