On Tue, Nov 27, 2012 at 07:08:06AM +0000, Mark Brown wrote: > + > +static int arizona_haptics_probe(struct platform_device *pdev) > +{ > + struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); > + struct arizona_haptics *haptics; > + int ret; > + > + haptics = kzalloc(sizeof(*haptics), GFP_KERNEL); > + if (!haptics) > + return -ENOMEM; > + > + haptics->arizona = arizona; > + > + ret = regmap_update_bits(arizona->regmap, ARIZONA_HAPTICS_CONTROL_1, > + ARIZONA_HAP_ACT, arizona->pdata.hap_act); > + if (ret != 0) { > + dev_err(arizona->dev, "Failed to set haptics actuator: %d\n", > + ret); Leaking haptics memory. > + return ret; > + } > + > + INIT_WORK(&haptics->work, arizona_haptics_work); > + > + haptics->input_dev = input_allocate_device(); > + if (haptics->input_dev == NULL) { > + dev_err(arizona->dev, "Failed to allocate input device\n"); Leaking haptics memory again. > + return -ENOMEM; > + } > + > + input_set_drvdata(haptics->input_dev, haptics); > + > + haptics->input_dev->name = "arizona:haptics"; > + haptics->input_dev->dev.parent = pdev->dev.parent; > + haptics->input_dev->close = arizona_haptics_close; > + __set_bit(FF_RUMBLE, haptics->input_dev->ffbit); > + > + ret = input_ff_create_memless(haptics->input_dev, NULL, > + arizona_haptics_play); > + if (ret < 0) { > + dev_err(arizona->dev, "input_ff_create_memless() failed: %d\n", > + ret); > + goto err_ialloc; > + } > + > + ret = input_register_device(haptics->input_dev); > + if (ret < 0) { > + dev_err(arizona->dev, "couldn't register input device: %d\n", > + ret); > + goto err_iff; > + } > + > + platform_set_drvdata(pdev, haptics); > + > + return 0; > + > +err_iff: > + if (haptics->input_dev) > + input_ff_destroy(haptics->input_dev); > +err_ialloc: > + input_free_device(haptics->input_dev); You are leaking haptics memory here. > + > + return ret; > +} > + > +static int arizona_haptics_remove(struct platform_device *pdev) > +{ > + struct arizona_haptics *haptics = platform_get_drvdata(pdev); > + > + input_unregister_device(haptics->input_dev); > + And here as well. > + return 0; > +} > + Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html