@@ -32,6 +32,7 @@ static int validate_cfg(const struct pbuf_cfg *cfg)
3232{
3333 /* Validate pointers. */
3434 if (!cfg || !cfg -> rd_idx_loc || !cfg -> wr_idx_loc || !cfg -> data_loc ) {
35+ printk ("Invalid pointers\n" );
3536 return - EINVAL ;
3637 }
3738
@@ -40,11 +41,13 @@ static int validate_cfg(const struct pbuf_cfg *cfg)
4041 !IS_PTR_ALIGNED_BYTES (cfg -> wr_idx_loc , MAX (cfg -> dcache_alignment , _PBUF_IDX_SIZE )) ||
4142 !IS_PTR_ALIGNED_BYTES (cfg -> handshake_loc , _PBUF_IDX_SIZE ) ||
4243 !IS_PTR_ALIGNED_BYTES (cfg -> data_loc , _PBUF_IDX_SIZE )) {
44+ printk ("Invalid alignment\n" );
4345 return - EINVAL ;
4446 }
4547
4648 /* Validate len. */
4749 if (cfg -> len < _PBUF_MIN_DATA_LEN || !IS_PTR_ALIGNED_BYTES (cfg -> len , _PBUF_IDX_SIZE )) {
50+ printk ("Invalid length\n" );
4851 return - EINVAL ;
4952 }
5053
@@ -55,6 +58,12 @@ static int validate_cfg(const struct pbuf_cfg *cfg)
5558 !((uint8_t * )cfg -> wr_idx_loc < cfg -> data_loc ) ||
5659 !(((uint8_t * )cfg -> rd_idx_loc + MAX (_PBUF_IDX_SIZE , cfg -> dcache_alignment )) ==
5760 (uint8_t * )cfg -> wr_idx_loc )) {
61+ printk ("Invalid pointer values\n" );
62+ printk ("rd_idx_loc: 0x%08X\n" , (uintptr_t )cfg -> rd_idx_loc );
63+ printk ("wr_idx_loc: 0x%08X\n" , (uintptr_t )cfg -> wr_idx_loc );
64+ printk ("handshake_loc: 0x%08X\n" , (uintptr_t )cfg -> handshake_loc );
65+ printk ("data_loc: 0x%08X\n" , (uintptr_t )cfg -> data_loc );
66+ printk ("dcache_alignment: 0x%08X\n" , (uintptr_t )cfg -> dcache_alignment );
5867 return - EINVAL ;
5968 }
6069
0 commit comments