From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753336AbcKUHfH (ORCPT ); Mon, 21 Nov 2016 02:35:07 -0500 Received: from mga07.intel.com ([134.134.136.100]:50633 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbcKUHfF (ORCPT ); Mon, 21 Nov 2016 02:35:05 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,674,1473145200"; d="scan'208";a="7281669" From: Alexander Shishkin To: Quentin Lambert , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Quentin Lambert Subject: Re: [PATCH] stm class: Add a missing call to put_device In-Reply-To: <20161119182241.9030-1-lambert.quentin@gmail.com> References: <20161119182241.9030-1-lambert.quentin@gmail.com> User-Agent: Notmuch/0.22.1 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 21 Nov 2016 09:32:55 +0200 Message-ID: <87k2bxe194.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quentin Lambert writes: > Most error branches following the call to class_find_device contain > a call to put_device. This patch add calls to put_device where > they are missing. > > This issue was found with Hector. > > Signed-off-by: Quentin Lambert > > --- > drivers/hwtracing/stm/core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- a/drivers/hwtracing/stm/core.c > +++ b/drivers/hwtracing/stm/core.c > @@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i > return -ENODEV; > > stmf = kzalloc(sizeof(*stmf), GFP_KERNEL); > - if (!stmf) > + if (!stmf) { > + put_device(dev); > return -ENOMEM; > + } There is a goto label at the bottom of this function which is supposed to deal with this. See the fix that we already have [1] for this issue. [1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id=a0ebf519b8a2666438d999c62995618c710573e5 Regards, -- alex