--- zzzz-none-000/linux-3.10.107/drivers/input/misc/max8997_haptic.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/input/misc/max8997_haptic.c 2021-02-04 17:41:59.000000000 +0000 @@ -23,7 +23,6 @@ */ #include -#include #include #include #include @@ -182,11 +181,21 @@ } if (!chip->enabled) { - chip->enabled = true; - regulator_enable(chip->regulator); + error = regulator_enable(chip->regulator); + if (error) { + dev_err(chip->dev, "Failed to enable regulator\n"); + goto out; + } max8997_haptic_configure(chip); - if (chip->mode == MAX8997_EXTERNAL_MODE) - pwm_enable(chip->pwm); + if (chip->mode == MAX8997_EXTERNAL_MODE) { + error = pwm_enable(chip->pwm); + if (error) { + dev_err(chip->dev, "Failed to enable PWM\n"); + regulator_disable(chip->regulator); + goto out; + } + } + chip->enabled = true; } out: @@ -371,8 +380,7 @@ return 0; } -#ifdef CONFIG_PM_SLEEP -static int max8997_haptic_suspend(struct device *dev) +static int __maybe_unused max8997_haptic_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max8997_haptic *chip = platform_get_drvdata(pdev); @@ -381,7 +389,6 @@ return 0; } -#endif static SIMPLE_DEV_PM_OPS(max8997_haptic_pm_ops, max8997_haptic_suspend, NULL); @@ -389,12 +396,11 @@ { "max8997-haptic", 0 }, { }, }; -MODULE_DEVICE_TABLE(i2c, max8997_haptic_id); +MODULE_DEVICE_TABLE(platform, max8997_haptic_id); static struct platform_driver max8997_haptic_driver = { .driver = { .name = "max8997-haptic", - .owner = THIS_MODULE, .pm = &max8997_haptic_pm_ops, }, .probe = max8997_haptic_probe, @@ -403,7 +409,6 @@ }; module_platform_driver(max8997_haptic_driver); -MODULE_ALIAS("platform:max8997-haptic"); MODULE_AUTHOR("Donggeun Kim "); MODULE_DESCRIPTION("max8997_haptic driver"); MODULE_LICENSE("GPL");