[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230613204024.zdp45ofohdur462p@intel.intel>
Date: Tue, 13 Jun 2023 22:40:24 +0200
From: Andi Shyti <andi.shyti@...nel.org>
To: Johannes Roith <johannes@...-linux.rocks>
Cc: jikos@...nel.org, linux-kernel@...r.kernel.org,
linux-input@...r.kernel.org
Subject: Re: [PATCH] hid-mcp2200 added driver for MCP2200 GPIOs
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
Powered by blists - more mailing lists