Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: ims-pcu - return error code rather than -ENOMEM

Currently the assignment of -ENOMEM to error is redundant because error
is not being read and -ENOMEM is being hard coded as an error return.
Fix this by returning the error code in variable 'error'; this also
allows the error code from a failed call to input_register_device to
be preserved and returned to the caller rather than just returning
a possibly inappropriate -ENOMEM.

Kudos to Dan Carpenter for the suggestion of an improved fix.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200603152151.139337-1-colin.king@canonical.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Colin Ian King and committed by
Dmitry Torokhov
d431b9e6 873a3a14

+1 -1
+1 -1
drivers/input/misc/ims-pcu.c
··· 335 335 err_free_mem: 336 336 input_free_device(input); 337 337 kfree(gamepad); 338 - return -ENOMEM; 338 + return error; 339 339 } 340 340 341 341 static void ims_pcu_destroy_gamepad(struct ims_pcu *pcu)