> + if ((ffs(dereg)-1) < ap->nr_pmp_links) {
> + /* array start from 0 */
> + link = &ap->pmp_link[ffs(dereg)-1];
I'd only call ffs() once - it could be a slow library function.
Any comment should note that ffs() returns 0 when no bits
are set - rather than anything about array indexes.
David