linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Johannes Roith <johannes@gnu-linux.rocks>
Cc: jikos@kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH] hid-mcp2200 added driver for MCP2200 GPIOs
Date: Tue, 13 Jun 2023 22:40:24 +0200	[thread overview]
Message-ID: <20230613204024.zdp45ofohdur462p@intel.intel> (raw)
In-Reply-To: <20230611144831.41238-1-johannes@gnu-linux.rocks>

Hi Joannes,

[...]

> +/* this executes the READ_ALL cmd */
> +static int mcp_cmd_read_all(struct mcp2200 *mcp)
> +{
> +	struct mcp_read_all *read_all;
> +	int len, t;
> +
> +	reinit_completion(&mcp->wait_in_report);
> +	mutex_lock(&mcp->lock);
> +
> +	read_all = kzalloc(sizeof(struct mcp_read_all), GFP_KERNEL);
> +	if (!read_all)
> +		return -ENOMEM;

where are you unlocking?

> +	read_all->cmd = READ_ALL;
> +	len = hid_hw_output_report(mcp->hdev, (u8 *) read_all,
> +			sizeof(struct mcp_read_all));
> +
> +	if (len != sizeof(struct mcp_read_all))
> +		return -EINVAL;

what about read_all? what about the lock?
> +
> +	kfree(read_all);
> +	mutex_unlock(&mcp->lock);
> +	t = wait_for_completion_timeout(&mcp->wait_in_report, msecs_to_jiffies(4000));
> +	if (!t)
> +		return -ETIMEDOUT;
> +
> +	/* return status, negative value if wrong response was received */
> +	return mcp->status;
> +}

[...]

Andi

      parent reply	other threads:[~2023-06-13 20:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-11 14:48 [PATCH] hid-mcp2200 added driver for MCP2200 GPIOs Johannes Roith
2023-06-11 18:22 ` kernel test robot
2023-06-11 18:43 ` kernel test robot
2023-06-13 20:40 ` Andi Shyti [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=20230613204024.zdp45ofohdur462p@intel.intel \
    --to=andi.shyti@kernel.org \
    --cc=jikos@kernel.org \
    --cc=johannes@gnu-linux.rocks \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).