On Wed, 2013-09-18 at 16:31 -0400, Eduardo Valentin wrote: > +/** > + * of_parse_thermal_zones - parse device tree thermal data > + * > + * Initialization function that can be called by machine initialization > + * code to parse thermal data and populate the thermal framework > + * with hardware thermal zones info. This function only parses thermal zones. > + * Cooling devices and sensor devices nodes are supposed to be parsed > + * by their respective drivers. > + * > + * Return: 0 on success, proper error code otherwise > + * > + */ > +int __init of_parse_thermal_zones(void) > +{ > + struct device_node *np, *child; > + struct __thermal_zone *tz; > + struct thermal_zone_device_ops *ops; > + > + np = of_find_node_by_name(NULL, "thermal-zones"); > + if (!np) { > + pr_err("unable to find thermal zones\n"); > + return 0; return 0? This is success? > + } > + > + for_each_child_of_node(np, child) { > + struct thermal_zone_device *zone; > + struct thermal_zone_params *tzp; > + > + tz = thermal_of_build_thermal_zone(child); > + if (IS_ERR(tz)) { > + pr_err("failed to build thermal zone %ld\n", > + PTR_ERR(tz)); > + return 0; > + } > + > + ops = kzalloc(sizeof(*ops), GFP_KERNEL); > + if (!ops) > + return 0; > + > + memcpy(ops, &of_thermal_ops, sizeof(*ops)); kmemdup instead of alloc/memcpy > + tzp = kzalloc(sizeof(*tzp), GFP_KERNEL); > + if (!ops) > + return 0; > + > + /* No hwmon because there might be hwmon drivers registering */ > + tzp->no_hwmon = true; > + > + zone = thermal_zone_device_register(child->name, tz->ntrips, > + 0, tz, > + ops, tzp, > + tz->passive_delay, > + tz->polling_delay); > + if (IS_ERR(zone)) > + pr_err("Failed to build %s zone %ld\n", child->name, > + PTR_ERR(zone)); > + } > + return 0; > +} All returns are 0, always successful? _______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors