From patchwork Tue May 2 20:34:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13229271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5C14C77B78 for ; Tue, 2 May 2023 20:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229829AbjEBUee (ORCPT ); Tue, 2 May 2023 16:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjEBUed (ORCPT ); Tue, 2 May 2023 16:34:33 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1E41997; Tue, 2 May 2023 13:34:32 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-63b5c830d5eso3077573b3a.2; Tue, 02 May 2023 13:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683059671; x=1685651671; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=KQ3mjNB18PJwmZ+twuLFKpTCTV95U8I5JkqBE5yVBMg=; b=O/xM7pixRfF3HafraVk7nXYz/EE1YDhNpopV/fr89Rz4GEAu1dce4tmBZtNShCvyMY WvDcGCFtQz7Yxs0dNBvbyEoxZDRNKrNB0qJ5ZBc+2ZXr6SWEO6GI9N3H9TQVvxPLF6hX hYwvgl5Chq1+Hn5yHFEuJoYtHUw3w1XnKrVIhQi5xBoLUfAV/61zSjhI5WJ0lHRLt79B 6VRbwkmu13cOxekg2n88TCmG7zma36whMBI7ZWE2aORQrifva3iK1k2hrcvLaOfLpRhA vP7XiXK0YYi/YRWw9exMIImsGe3vnA1anbX+ZDx9DvxJoGmvxyokwdaNe2GDwvwdK4T2 H5Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683059671; x=1685651671; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KQ3mjNB18PJwmZ+twuLFKpTCTV95U8I5JkqBE5yVBMg=; b=bjKFMjpQcQ5/qLRfZHPiBCey1kKx98LD5Y35tnPhGpqdMR/c8CA86B758bRbPCDfFN lzisK5lwOkYUVeORmaxR+KdJ6vTg16PCeluwW7gtosoSGQEgBIl+IvHwZ5Hb89jxBG/D arzXPb9JMXLD7OO1WaA2wdZrXfNTxr1R1+WrL4tCgKjxeWoaKA8BYzhpVHfTgm/YzIAj 24K1tRU8fo4cZCyQ6fOvo8MFuWeB9G9GmsOoRrzcNoNvWXnLE5bMqfkoCqaJJ4qJSB33 xSIu2bIJRBKd9o9LCo2tiyjOE4+emRPOxrb5JagjLyrLXBthfR1pe0AScDEjECYTccUo YAQQ== X-Gm-Message-State: AC+VfDxvV1lQ/0Ul321CTWnK8MBNDzBrga14TFJmiSqjY1qvzTHWk60/ xdCK1zOQgbC4V0hrPSWKQLU0/kymNAk= X-Google-Smtp-Source: ACHHUZ7KWTtXy4fKW93zEk4BISCpysB9KrHIKp0qZq2IucUJLiCKVJvbqlqfhMl4WOa3Ktq1p5gomQ== X-Received: by 2002:a05:6a21:168c:b0:f2:be63:23ed with SMTP id np12-20020a056a21168c00b000f2be6323edmr20181013pzb.35.1683059670531; Tue, 02 May 2023 13:34:30 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:6edf:1ae0:55be:72db]) by smtp.gmail.com with ESMTPSA id z21-20020a62d115000000b0063d24fcc2b7sm22180639pfg.1.2023.05.02.13.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 13:34:29 -0700 (PDT) Date: Tue, 2 May 2023 13:34:27 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Peter Hutterer Subject: [PATCH] Input: fix open count when closing inhibited device Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Because the kernel increments device's open count in input_open_device() even if device is inhibited, the counter should always be decremented in input_close_device() to keep it balanced. Fixes: a181616487db ("Input: Add "inhibited" property") Signed-off-by: Dmitry Torokhov Reviewed-by: Peter Hutterer --- drivers/input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index f791d14ecf23..8c5fdb0f858a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -705,7 +705,7 @@ void input_close_device(struct input_handle *handle) __input_release_device(handle); - if (!dev->inhibited && !--dev->users) { + if (!--dev->users && !dev->inhibited) { if (dev->poller) input_dev_poller_stop(dev->poller); if (dev->close)