Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp866645ybt; Sun, 14 Jun 2020 02:30:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFm4wIUYhWXRjb5mWtokm5IhdHFhBzLUPiboX9pjk11MdiZGknAUhwgpWbh097pmStLwOu X-Received: by 2002:a17:906:1c49:: with SMTP id l9mr4734005ejg.296.1592127001622; Sun, 14 Jun 2020 02:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592127001; cv=none; d=google.com; s=arc-20160816; b=D836IEd8TELG8jnaTffkX6K7FOEuDv2a0sv03uNIHMbZymD9Ew026r70rak3N28A1F Qjtc+2i3jvr8tFni2Ghc23ctPFdIkPwMGuGwftmMtnJAiFr/S8GbMEtVRlT3BuY6HOSP lwFOGz9Knym+Fz3Z/XEOE7lmXW4qY/KAsK9uuSYdxwj/qKLYVfhigdDh5zI7W4S2DBgQ aKdPUeb+cLlyqntdoXJq9yr8P+Yd3Yqop/oBgku78wEMarrW93+qT/MguiElZmrg4BSn Bgm6z//9hvQewXBBdMqarW7lZ5IKGwY3+HxeAACKHkw4xx9c1U+YhOxLwfoYd7R9h4GP AXJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lUhVNgMNBvLuhdDecLJTYJjP1POR5VFuzoz3PWt0le8=; b=DI/7RHJtYvcN0MrcKt3g4wjbj7EIWRCCG245635AsYI78yMvnLwgai2zuHnmd6RccX Qhb9qTIjsb7vI4P88jYVZkogB98JNf+XuZi289KxhtnNCFxJmF9ezAFTRbJNUaHyHn1+ NBzKSuNJbGAI8S53ab599coKC/Plo0sBUMrZNS68ES5y7i31IK3CW4MdYKH+GqWzNxpK e58TLm6tdfGNpS0Cfxrt/v3vQEztl4NKZibFTSNemdfXMi7PArd93daJyq9xwbOt5zXZ BmPrUmdAZVtcBcj3xo2YmmBpdm6GEgCzEeO+hUQRN1dnsLoCSfZi016yVxymiPm5WTHY u29Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TUy+QXvX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr21si11163844ejc.489.2020.06.14.02.29.39; Sun, 14 Jun 2020 02:30:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TUy+QXvX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726926AbgFNJ14 (ORCPT + 99 others); Sun, 14 Jun 2020 05:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725265AbgFNJ1z (ORCPT ); Sun, 14 Jun 2020 05:27:55 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2CAAC03E969; Sun, 14 Jun 2020 02:27:55 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id s88so5763260pjb.5; Sun, 14 Jun 2020 02:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lUhVNgMNBvLuhdDecLJTYJjP1POR5VFuzoz3PWt0le8=; b=TUy+QXvXeae7GFe0vxOs9GdhXkWBMRIwEBMfm9hsC+nteuz4EU3Zh3garNhl+/URl9 Se6npddwZirvj8b5fHp/1ateoUpnJBgnmFZbDwRDEVZ+uWRM7cKCNueGUGCaydmIhwmR YrjH2KDK/q6Fk8SVlms8KQV9KUHWpYkvv8zZrd2kb33FS5AoX4C2FemwLCU5RSC2/xvX ZzkoJZ+Dn8S2k+lama944RWnrT/fd0w6swlS4ufph0RQovf0kemGJCi/bD59pVzkJYCy GqGIFL2zj4gJjwLThkg0hoeR5EgHmP2TqoSrDYpgIakVIVg67ZxOcrClXpj1e7ljurqd LIzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lUhVNgMNBvLuhdDecLJTYJjP1POR5VFuzoz3PWt0le8=; b=jqcF1kefE0QFkonxA11BeBvy9ku+oDleS7VJWo3IpvMSaE6I75YH+7s1J+/9GNydJo 8c0/0pipgMbzhqYglbjolgZVcdkM2J/+A1W0rN8x+pAc7yTqQEeWychH4Pn3T8a3je4l j83uRmF3rJrb/0CW2/12WymDuf/D4/9pPgypYlyKBiVPRWQxKikt8J240+qqNznrFffx 8x+cTGkyTSBSaoDOWpYTkx9C7XcgqY10qH7V/lh7pD/13GaX+CpFwrDLv4jTBPiNctvW 2UvnhjJKKiAt5CzjFNpElemPilr+qKMrqt/GbzMA9QRTx8cbv1+9HtjBQ0KRCi46vWyy sBHg== X-Gm-Message-State: AOAM533Jgz7O2kldoxCLSbSARGcskKzqMkwhqC94b8qUPsaxzGcqZFAp T3ACtqjOGUew+aaa8hbxoio9ILxej9SMkbOAH4M= X-Received: by 2002:a17:90a:220f:: with SMTP id c15mr7131529pje.129.1592126875196; Sun, 14 Jun 2020 02:27:55 -0700 (PDT) MIME-Version: 1.0 References: <20200614055604.67969-1-navid.emamdoost@gmail.com> In-Reply-To: <20200614055604.67969-1-navid.emamdoost@gmail.com> From: Andy Shevchenko Date: Sun, 14 Jun 2020 12:27:38 +0300 Message-ID: Subject: Re: [PATCH] Input: bma150: fix ref count leak in bma150_open To: Navid Emamdoost Cc: Dmitry Torokhov , Jonathan Bakker , =?UTF-8?Q?Pawe=C5=82_Chmiel?= , linux-input , Linux Kernel Mailing List , Navid Emamdoost , wu000273@umn.edu, Kangjie Lu , Stephen McCamant Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 14, 2020 at 8:58 AM Navid Emamdoost wrote: > > in bma150_open, pm_runtime_get_sync is called which > increments the counter even in case of failure, leading to incorrect > ref count. In case of failure, decrement the ref count before returning. ... > error = pm_runtime_get_sync(&bma150->client->dev); > if (error < 0 && error != -ENOSYS) > - return error; > + goto out; So, what will happen in case of -ENOSYS? ... > + pm_runtime_put(&bma150->client->dev); Slightly better to use _put_noidle(). (More consistency with error path) -- With Best Regards, Andy Shevchenko