Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbcKSS0P (ORCPT ); Sat, 19 Nov 2016 13:26:15 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36772 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753118AbcKSS0D (ORCPT ); Sat, 19 Nov 2016 13:26:03 -0500 From: Quentin Lambert To: Alexander Shishkin , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Quentin Lambert Subject: [PATCH] stm class: Add a missing call to put_device Date: Sat, 19 Nov 2016 19:22:41 +0100 Message-Id: <20161119182241.9030-1-lambert.quentin@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 679 Lines: 26 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; + } stm_output_init(&stmf->output); stmf->stm = to_stm_device(dev);