Altera_Forum
Honored Contributor
16 years agoProblem in alt_find_dev
I've got a DMA component in my system named "/dev/dma". I copied code from the Memtest template so it should work. However, calling alt_dma_txchan_open("/dev/dma") fails. I traced down into the library code and found that alt_find_dev was performing a memcmp on the name. If I manually change the number of bytes to compare, then memcmp will pass otherwise it fails. Any ideas if I'm doing something wrong?
alt_dev* alt_find_dev(const char* name, alt_llist* llist)
{
alt_dev* next = (alt_dev*) llist->next;
alt_32 len;
// change this line to pass
len = strlen(name) + 1; // fails
len = strlen(name); // passes
while (next != (alt_dev*) llist)
{
if (!memcmp (next->name, name, len))
{
/* match found */
return next;
}
next = (alt_dev*) next->llist.next;
}
return NULL;
}