Loading drivers/input/misc/qcom-hv-haptics.c +15 −11 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ #include <linux/input.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/nvmem-consumer.h> #include <linux/of.h> Loading Loading @@ -2196,12 +2197,15 @@ static int haptics_load_custom_effect(struct haptics_chip *chip, * Before allocating samples buffer, free the old sample * buffer first if it's not been freed. */ kfree(fifo->samples); kvfree(fifo->samples); fifo->samples = kcalloc(custom_data.length, sizeof(u8), GFP_KERNEL); if (!fifo->samples) { fifo->samples = vmalloc(custom_data.length); if (!fifo->samples) { rc = -ENOMEM; goto unlock; } } if (copy_from_user(fifo->samples, (u8 __user *)custom_data.data, Loading Loading @@ -2245,7 +2249,7 @@ static int haptics_load_custom_effect(struct haptics_chip *chip, mutex_unlock(&chip->play.lock); return 0; cleanup: kfree(fifo->samples); kvfree(fifo->samples); fifo->samples = NULL; unlock: mutex_unlock(&chip->play.lock); Loading Loading @@ -2438,7 +2442,7 @@ static int haptics_stop_fifo_play(struct haptics_chip *chip) return rc; haptics_fifo_empty_irq_config(chip, false); kfree(chip->custom_effect->fifo->samples); kvfree(chip->custom_effect->fifo->samples); chip->custom_effect->fifo->samples = NULL; atomic_set(&chip->play.fifo_status.is_busy, 0); Loading Loading @@ -2717,15 +2721,15 @@ static int haptics_hw_init(struct haptics_chip *chip) return rc; /* get calibrated close loop period */ rc = haptics_get_closeloop_lra_period(chip, true); if (rc < 0) return rc; /* Config T_LRA */ t_lra_us = chip->config.t_lra_us; if (chip->config.cl_t_lra_us != 0) rc = haptics_get_closeloop_lra_period(chip, true); if (!rc && chip->config.cl_t_lra_us != 0) t_lra_us = chip->config.cl_t_lra_us; else dev_warn(chip->dev, "get closeloop LRA period failed, rc=%d\n", rc); /* Config T_LRA */ rc = haptics_config_openloop_lra_period(chip, t_lra_us); if (rc < 0) return rc; Loading Loading
drivers/input/misc/qcom-hv-haptics.c +15 −11 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ #include <linux/input.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/nvmem-consumer.h> #include <linux/of.h> Loading Loading @@ -2196,12 +2197,15 @@ static int haptics_load_custom_effect(struct haptics_chip *chip, * Before allocating samples buffer, free the old sample * buffer first if it's not been freed. */ kfree(fifo->samples); kvfree(fifo->samples); fifo->samples = kcalloc(custom_data.length, sizeof(u8), GFP_KERNEL); if (!fifo->samples) { fifo->samples = vmalloc(custom_data.length); if (!fifo->samples) { rc = -ENOMEM; goto unlock; } } if (copy_from_user(fifo->samples, (u8 __user *)custom_data.data, Loading Loading @@ -2245,7 +2249,7 @@ static int haptics_load_custom_effect(struct haptics_chip *chip, mutex_unlock(&chip->play.lock); return 0; cleanup: kfree(fifo->samples); kvfree(fifo->samples); fifo->samples = NULL; unlock: mutex_unlock(&chip->play.lock); Loading Loading @@ -2438,7 +2442,7 @@ static int haptics_stop_fifo_play(struct haptics_chip *chip) return rc; haptics_fifo_empty_irq_config(chip, false); kfree(chip->custom_effect->fifo->samples); kvfree(chip->custom_effect->fifo->samples); chip->custom_effect->fifo->samples = NULL; atomic_set(&chip->play.fifo_status.is_busy, 0); Loading Loading @@ -2717,15 +2721,15 @@ static int haptics_hw_init(struct haptics_chip *chip) return rc; /* get calibrated close loop period */ rc = haptics_get_closeloop_lra_period(chip, true); if (rc < 0) return rc; /* Config T_LRA */ t_lra_us = chip->config.t_lra_us; if (chip->config.cl_t_lra_us != 0) rc = haptics_get_closeloop_lra_period(chip, true); if (!rc && chip->config.cl_t_lra_us != 0) t_lra_us = chip->config.cl_t_lra_us; else dev_warn(chip->dev, "get closeloop LRA period failed, rc=%d\n", rc); /* Config T_LRA */ rc = haptics_config_openloop_lra_period(chip, t_lra_us); if (rc < 0) return rc; Loading