[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1109271843030.24692@pobox.suse.cz>
Date: Tue, 27 Sep 2011 18:43:17 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Amit Nagal <helloin.amit@...il.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] HID: hidraw: open count should not increase if
error
On Tue, 27 Sep 2011, Amit Nagal wrote:
> In hidraw_open, if hid_hw_power returns with error,
> hidraw device open count should not increase.
>
> Signed-off-by: Amit Nagal <helloin.amit@...il.com>
> ---
> drivers/hid/hidraw.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
> index c841a8e..09bbcc9 100644
> --- a/drivers/hid/hidraw.c
> +++ b/drivers/hid/hidraw.c
> @@ -271,8 +271,10 @@ static int hidraw_open(struct inode *inode, struct file *file)
> dev = hidraw_table[minor];
> if (!dev->open++) {
> err = hid_hw_power(dev->hid, PM_HINT_FULLON);
> - if (err < 0)
> + if (err < 0) {
> + dev->open--;
> goto out_unlock;
> + }
>
> err = hid_hw_open(dev->hid);
> if (err < 0) {
Good catch, thanks. Applied.
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists