On Thu, Feb 26, 2015 at 11:49:36AM +0900, Jaewon Kim wrote:I never image at all that i am not assign 'error' variable.
Hi Dmitry,What I was trying to say is that you do not assign new value to 'error'
On 26/02/2015 10:23, Dmitry Torokhov wrote:
Hi Jaewon,You are right.
On Tue, Feb 24, 2015 at 10:29:07AM +0900, Jaewon Kim wrote:
+static void max77843_haptic_play_work(struct work_struct *work)You do not need braces around single statement. Also, this is not error
+{
+ struct max77843_haptic *haptic =
+ container_of(work, struct max77843_haptic, work);
+ int error;
+
+ mutex_lock(&haptic->mutex);
+
+ if (haptic->suspended) {
+ goto err_play;
+ }
+
that you are handling, I'd prefer if we called this label out_unlock.
I will change label name and remove braces.
It do not need to set duty cycle requisitely when disabling haptic.+ error = max77843_haptic_set_duty_cycle(haptic);Do you need to configure duty cycle if you stopping the playback? Or
+ if (error) {
+ dev_err(haptic->dev, "failed to set duty cycle: %d\n", error);
+ goto err_play;
+ }
maybe disabling pwm is enough?
I will move this function to front of max77843_haptic_enable().
Detailed error message printed in enable/disable() function.+What error? You did not assign it...
+ if (haptic->magnitude) {
+ error = max77843_haptic_enable(haptic);
+ if (error)
+ dev_err(haptic->dev,
+ "cannot enable haptic: %d\n", error);
+ } else {
+ max77843_haptic_disable(haptic);
+ if (error)
+ dev_err(haptic->dev,
+ "cannot disable haptic: %d\n", error);
variable in this path; it still carries the value from
max77843_haptic_set_duty_cycle() above and so this "if" statement will
never work and the message will never show up.
Thanks.