Lines Matching +full:everything +full:- +full:else
8 A lot of this was lifted from Greg Kroah-Hartman's 2004 OLS paper and
11 - http://www.kroah.com/linux/talks/ols_2004_kref_paper/Reprint-Kroah-Hartman-OLS2004.pdf
12 - http://www.kroah.com/linux/talks/ols_2004_kref_talk/
45 return -ENOMEM;
46 kref_init(&data->refcount);
56 1) If you make a non-temporary copy of a pointer, especially if
60 kref_get(&data->refcount);
62 If you already have a valid pointer to a kref-ed structure (the
67 kref_put(&data->refcount, data_release);
71 a valid pointer to a kref-ed structure without already
75 3) If the code attempts to gain a reference to a kref-ed structure
95 kref_put(&data->refcount, data_release);
105 return -ENOMEM;
106 kref_init(&data->refcount);
108 kref_get(&data->refcount);
110 if (task == ERR_PTR(-ENOMEM)) {
111 rv = -ENOMEM;
112 kref_put(&data->refcount, data_release);
120 kref_put(&data->refcount, data_release);
139 if (task == ERR_PTR(-ENOMEM)) {
140 rv = -ENOMEM;
142 } else
143 /* BAD BAD BAD - get is after the handoff */
144 kref_get(&data->refcount);
149 involved where the above may be legal) but someone else who doesn't
155 something else or passing it off to something else, there is no reason
159 kref_get(&obj->ref);
161 kref_put(&obj->ref, obj_cleanup);
170 instance, you have a list of items that are each kref-ed, and you wish
190 kref_get(&entry->refcount);
200 list_del(&entry->link);
207 kref_put(&entry->refcount, release_entry);
224 if (kref_put(&entry->refcount, release_entry)) {
225 list_del(&entry->link);
228 } else
234 same lock. Note that doing everything in the release routine is still
246 if (!kref_get_unless_zero(&entry->refcount))
258 list_del(&entry->link);
265 kref_put(&entry->refcount, release_entry);
297 if (!kref_get_unless_zero(&entry->refcount))
309 list_del_rcu(&entry->link);
316 kref_put(&entry->refcount, release_entry_rcu);