All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Feng-Yi Hsueh" <fyhsueh4linux@gmail.com>, linux-input@vger.kernel.org
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	dmitry.torokhov@gmail.com
Subject: Re: [PATCH v1 2/2] Input: keyboard: Add Nuvoton MA35D1 keypad driver
Date: Tue, 10 Nov 2026 11:24:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-206933@kernel.org> (raw)
In-Reply-To: <20261110111419.89535-3-fyhsueh4linux@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] Input: ma35d1_keypad - use guard(mutex) in suspend and resume
  callbacks
- [Low] Input: ma35d1_keypad - name errno variables error and return 0
  explicitly
--

commit ca9c8a019e4d03872087b6ba2c747cf4ce6faf45
Author: Feng-Yi Hsueh <fyhsueh4linux@gmail.com>

Input: keyboard: Add Nuvoton MA35D1 keypad driver

This commit adds an input driver for the Nuvoton MA35D1 hardware matrix
keypad controller, handling key press/release interrupts, input event
reporting, and clock management across open, close, suspend, and resume.

> diff --git a/drivers/input/keyboard/ma35d1_keypad.c b/drivers/input/keyboard/ma35d1_keypad.c
> new file mode 100644
> index 0000000000000..673ad8b9704bd
> --- /dev/null
> +++ b/drivers/input/keyboard/ma35d1_keypad.c

[ ... ]

> +/* Called with input->mutex held (open, PM resume). */
> +static int ma35d1_keypad_enable(struct ma35d1_keypad *keypad)
> +{
> +	int ret;
> +
> +	if (keypad->running)
> +		return 0;
> +
> +	ret = clk_prepare_enable(keypad->clk);
> +	if (ret)
> +		return ret;

[Severity: Low]
This isn't a bug, but in the input subsystem, variables that only hold 0
or a negative error code are conventionally named error or err rather than
ret.  The same applies to ma35d1_keypad_resume() and ma35d1_keypad_probe(),
and ma35d1_keypad_resume() should also explicitly return 0 on the success
path rather than returning the error variable directly.

[ ... ]

> +static int ma35d1_keypad_suspend(struct device *dev)
> +{
> +	struct ma35d1_keypad *keypad = dev_get_drvdata(dev);
> +	struct input_dev *input = keypad->input;
> +
> +	mutex_lock(&input->mutex);
> +	if (input_device_enabled(input))
> +		ma35d1_keypad_disable(keypad);
> +	mutex_unlock(&input->mutex);
> +
> +	return 0;
> +}
> +
> +static int ma35d1_keypad_resume(struct device *dev)
> +{
> +	struct ma35d1_keypad *keypad = dev_get_drvdata(dev);
> +	struct input_dev *input = keypad->input;
> +	int ret = 0;
> +
> +	mutex_lock(&input->mutex);
> +	if (input_device_enabled(input))
> +		ret = ma35d1_keypad_enable(keypad);
> +	mutex_unlock(&input->mutex);
> +
> +	return ret;
> +}

[Severity: Low]
This isn't a bug, but new input drivers prefer guard(mutex)(&input->mutex)
over manual mutex_lock() and mutex_unlock() calls in
ma35d1_keypad_suspend() and ma35d1_keypad_resume().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110111419.89535-1-fyhsueh4linux@gmail.com?part=2

      reply	other threads:[~2026-11-10 11:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 11:14 [PATCH v1 0/2] Input: Add Nuvoton MA35D1 keypad support Feng-Yi Hsueh
2026-11-10 11:14 ` [PATCH v1 1/2] dt-bindings: input: Add Nuvoton MA35D1 keypad controller Feng-Yi Hsueh
2026-11-10 11:25   ` sashiko-bot
2026-11-10 18:36   ` Conor Dooley
2026-11-10 11:14 ` [PATCH v1 2/2] Input: keyboard: Add Nuvoton MA35D1 keypad driver Feng-Yi Hsueh
2026-11-10 11:24   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-206933@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=fyhsueh4linux@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.