Hello Dmitry, On Mon, Jul 01, 2024 at 03:51:43PM -0700, Dmitry Torokhov wrote: > On Mon, Jul 01, 2024 at 10:28:09PM +0200, Uwe Kleine-König wrote: > > If you keep ret it's consistent with the other functions in this driver > > (at least the one you touched above). > > This is part of my quest to have variables that hold error codes (i.e. > when we do not return them in case of success) to be called "error". > "ret" or "retval" is to be used when it is returned in both error and > success cases; before the guard notation we needed to use the same > variable in both success and failure. That seems to be a bit artificial to me, given that you changed the variable "ret" in adp5588_gpio_direction_output() to "error" and the resulting code can be further simplified using diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 09bcfc6b9408..5c8f07bbc452 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -313,10 +313,8 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip, return error; error = adp5588_write(kpad->client, GPIO_DIR1 + bank, kpad->dir[bank]); - if (error) - return error; - return 0; + return error; } static int adp5588_build_gpiomap(struct adp5588_kpad *kpad) There are further inconsistencies in this driver, e.g. ret in adp5588_fw_parse() isn't returned in the success path. adp5588_probe() has both, error and ret, neither is used in the success path and a single variable would be enough. Given that, I'd suggest to make two commits: Let the driver use guards without unmentioned and incomplete cleanups in the variable naming and then in an additional changeset unify the error variable naming in the complete driver. Best regards Uwe
Attachment:
signature.asc
Description: PGP signature