Re: Purge a linked list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Ron,

I believe the problem is that you should be using the list_for_each_safe macro 
instead of list_for_each

-- 
Miguel

On Wednesday 26 September 2007, Ron Lee wrote:
> Hello all,
>
> I am trying to use the standard structure list_head for linked lists
> in the kernel. So far, I can search and add items to my linked list.
> I can remove items from my linked list.
>
> But when I want to purge the entire linked list. I get a kernel oops.
> Does anyone have any suggestions? Any help is highly appreciated!
>
> Thanks,
> Ron
>
> struct frule {
> 	int data;
> 	struct list_head list;
> };
>
> static void release_frules(struct frule *frs)
> {
> 	struct frule *fr;
> 	struct list_head *p;
>
> 	list_for_each(p, frs) {
> 		fr = list_entry(p, struct frule, list);
> 		list_del(p);
> 		kfree(fr);
> 	}
>
> 	return;
> }
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux