Merge tag 'kbuild-v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[linux-2.6-microblaze.git] / drivers / pwm / sysfs.c
index 83f2b0b..7c71cdb 100644 (file)
@@ -273,7 +273,8 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm)
        ret = device_register(&export->child);
        if (ret) {
                clear_bit(PWMF_EXPORTED, &pwm->flags);
-               kfree(export);
+               put_device(&export->child);
+               export = NULL;
                return ret;
        }