Commit 2d389464 authored by Evgeniy Polyakov's avatar Evgeniy Polyakov Committed by Greg Kroah-Hartman

[PATCH] w1: Added w1_check_family().

w1_check_family() checks new family before registering it.
Signed-off-by: default avatarEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 23e5e116
......@@ -27,12 +27,23 @@
spinlock_t w1_flock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(w1_families);
static int w1_check_family(struct w1_family *f)
{
if (!f->fops->rname || !f->fops->rbin || !f->fops->rval || !f->fops->rvalname)
return -EINVAL;
return 0;
}
int w1_register_family(struct w1_family *newf)
{
struct list_head *ent, *n;
struct w1_family *f;
int ret = 0;
if (w1_check_family(newf))
return -EINVAL;
spin_lock(&w1_flock);
list_for_each_safe(ent, n, &w1_families) {
f = list_entry(ent, struct w1_family, family_entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment