Skip to content

Commit 3caae64

Browse files
committed
porting: fix "cast from pointer to integer of different size" error
Changed direct casting of pointer to uint32_t to (uint32_t)(uintptr_t).
1 parent b36f96b commit 3caae64

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

porting/nimble/src/os_mbuf.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ os_mbuf_get(struct os_mbuf_pool *omp, uint16_t leadingspace)
245245
struct os_mbuf *om;
246246

247247
os_trace_api_u32x2(OS_TRACE_ID_MBUF_GET, (uint32_t)omp,
248-
(uint32_t)leadingspace);
248+
(uint32_t)(uintptr_t)leadingspace);
249249

250250
if (leadingspace > omp->omp_databuf_len) {
251251
om = NULL;
@@ -265,7 +265,7 @@ os_mbuf_get(struct os_mbuf_pool *omp, uint16_t leadingspace)
265265
om->om_omp = omp;
266266

267267
done:
268-
os_trace_api_ret_u32(OS_TRACE_ID_MBUF_GET, (uint32_t)om);
268+
os_trace_api_ret_u32(OS_TRACE_ID_MBUF_GET, (uint32_t)(uintptr_t)om);
269269
return om;
270270
}
271271

@@ -276,7 +276,7 @@ os_mbuf_get_pkthdr(struct os_mbuf_pool *omp, uint8_t user_pkthdr_len)
276276
struct os_mbuf_pkthdr *pkthdr;
277277
struct os_mbuf *om;
278278

279-
os_trace_api_u32x2(OS_TRACE_ID_MBUF_GET_PKTHDR, (uint32_t)omp,
279+
os_trace_api_u32x2(OS_TRACE_ID_MBUF_GET_PKTHDR, (uint32_t)(uintptr_t)omp,
280280
(uint32_t)user_pkthdr_len);
281281

282282
/* User packet header must fit inside mbuf */
@@ -298,7 +298,7 @@ os_mbuf_get_pkthdr(struct os_mbuf_pool *omp, uint8_t user_pkthdr_len)
298298
}
299299

300300
done:
301-
os_trace_api_ret_u32(OS_TRACE_ID_MBUF_GET_PKTHDR, (uint32_t)om);
301+
os_trace_api_ret_u32(OS_TRACE_ID_MBUF_GET_PKTHDR, (uint32_t)(uintptr_t)om);
302302
return om;
303303
}
304304

@@ -307,7 +307,7 @@ os_mbuf_free(struct os_mbuf *om)
307307
{
308308
int rc;
309309

310-
os_trace_api_u32(OS_TRACE_ID_MBUF_FREE, (uint32_t)om);
310+
os_trace_api_u32(OS_TRACE_ID_MBUF_FREE, (uint32_t)(uintptr_t)om);
311311

312312
if (om->om_omp != NULL) {
313313
rc = os_memblock_put(om->om_omp->omp_pool, om);
@@ -329,7 +329,7 @@ os_mbuf_free_chain(struct os_mbuf *om)
329329
struct os_mbuf *next;
330330
int rc;
331331

332-
os_trace_api_u32(OS_TRACE_ID_MBUF_FREE_CHAIN, (uint32_t)om);
332+
os_trace_api_u32(OS_TRACE_ID_MBUF_FREE_CHAIN, (uint32_t)(uintptr_t)om);
333333

334334
while (om != NULL) {
335335
next = SLIST_NEXT(om, om_next);

porting/nimble/src/os_mempool.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ os_memblock_get(struct os_mempool *mp)
333333
os_sr_t sr;
334334
struct os_memblock *block;
335335

336-
os_trace_api_u32(OS_TRACE_ID_MEMBLOCK_GET, (uint32_t)mp);
336+
os_trace_api_u32(OS_TRACE_ID_MEMBLOCK_GET, (uint32_t)(uintptr_t)mp);
337337

338338
/* Check to make sure they passed in a memory pool (or something) */
339339
block = NULL;
@@ -361,7 +361,7 @@ os_memblock_get(struct os_mempool *mp)
361361
}
362362
}
363363

364-
os_trace_api_ret_u32(OS_TRACE_ID_MEMBLOCK_GET, (uint32_t)block);
364+
os_trace_api_ret_u32(OS_TRACE_ID_MEMBLOCK_GET, (uint32_t)(uintptr_t)block);
365365

366366
return (void *)block;
367367
}
@@ -372,8 +372,8 @@ os_memblock_put_from_cb(struct os_mempool *mp, void *block_addr)
372372
os_sr_t sr;
373373
struct os_memblock *block;
374374

375-
os_trace_api_u32x2(OS_TRACE_ID_MEMBLOCK_PUT_FROM_CB, (uint32_t)mp,
376-
(uint32_t)block_addr);
375+
os_trace_api_u32x2(OS_TRACE_ID_MEMBLOCK_PUT_FROM_CB, (uint32_t)(uintptr_t)mp,
376+
(uint32_t)(uintptr_t)block_addr);
377377

378378
os_mempool_guard_check(mp, block_addr);
379379
os_mempool_poison(mp, block_addr);
@@ -405,8 +405,8 @@ os_memblock_put(struct os_mempool *mp, void *block_addr)
405405
struct os_memblock *block;
406406
#endif
407407

408-
os_trace_api_u32x2(OS_TRACE_ID_MEMBLOCK_PUT, (uint32_t)mp,
409-
(uint32_t)block_addr);
408+
os_trace_api_u32x2(OS_TRACE_ID_MEMBLOCK_PUT, (uint32_t)(uintptr_t)mp,
409+
(uint32_t)(uintptr_t)block_addr);
410410

411411
/* Make sure parameters are valid */
412412
if ((mp == NULL) || (block_addr == NULL)) {

0 commit comments

Comments
 (0)