summaryrefslogtreecommitdiff
path: root/io-module/mtac.c
blob: b9a25206de030c3b9ca58a17e67c438385da9c81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
static struct kobj_attribute* create_attribute(const char* _name, umode_t _mode) {
	char* attr_name;
	struct kobj_attribute* _attr;
	
	_attr = kzalloc(sizeof(struct kobj_attribute), GFP_KERNEL);
	if (! _attr) {
		log_error("kzalloc of attribute %s failed", _name);
		return NULL;
	}

	sysfs_attr_init(_attr);
	attr_name = kstrdup(_name, GFP_KERNEL);
	if (! attr_name) {
		log_error("GFP_KERNEL dup failed for attribute [%s]", _name);
		return NULL;
	}

	_attr->attr.name = attr_name;
	_attr->attr.mode = _mode;

	return _attr;
}