On Tuesday 14 December 2010 10:58:14 Linus Lüssing wrote:
+#define BAT_ATTR_IF_STORE_UINT(_name, _min, _max, _post_func) \ +ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
char *buff, size_t count) \
+{ \
struct net_device *net_dev = kobj_to_netdev(kobj); \
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); \
return __store_uint_attr(buff, count, _min, _max, _post_func, \
attr, &batman_if->_name, net_dev); \
+}
+#define BAT_ATTR_IF_SHOW_UINT(_name) \ +ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \
char *buff) \
+{ \
struct net_device *net_dev = kobj_to_netdev(kobj); \
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); \
return sprintf(buff, "%i\n", atomic_read(&batman_if->_name)); \
+}
get_batman_if_by_netdev() increases the batman_if refcount which is never decreased. Check the other get_batman_if_by_netdev() calls in the same file to get an idea how to handle this,
Cheers, Marek