Klaus Kudielka <[email protected]> writes: > ++ err = led_classdev_register(&client->dev, &leds[i].led_cdev); > ++ if (err < 0) > ++ goto exit; > ++ > ++ err = device_create_file(leds[i].led_cdev.dev, > ++ &dev_attr_autonomous); > ++ if (err < 0) { > ++ dev_err(leds[i].led_cdev.dev, > ++ "failed to create attribute autonomous\n"); > ++ goto exit; > ++ } > ++ > ++ err = device_create_file(leds[i].led_cdev.dev, > ++ &dev_attr_color); > ++ if (err < 0) { > ++ dev_err(leds[i].led_cdev.dev, > ++ "failed to create attribute color\n"); > ++ goto exit; > ++ } > +
I believe GregKH often complains about patterns like this because of the userspace race it creates. Why not add the extra attributes to a group and point leds[i].led_cdev.groups to it instead? Then you get automatic attribute creation in led_classdev_register. No race and much simpler error handling and cleanup. Bjørn _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
