From patchwork Wed Dec 12 20:24:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Yariv X-Patchwork-Id: 1870301 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 87BB93FC81 for ; Wed, 12 Dec 2012 20:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754756Ab2LLUdR (ORCPT ); Wed, 12 Dec 2012 15:33:17 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:47358 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754245Ab2LLUdR (ORCPT ); Wed, 12 Dec 2012 15:33:17 -0500 X-Greylist: delayed 484 seconds by postgrey-1.27 at vger.kernel.org; Wed, 12 Dec 2012 15:33:17 EST Received: by mail-wg0-f43.google.com with SMTP id e12so449703wge.10 for ; Wed, 12 Dec 2012 12:33:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=neia6P7p1O9X3JtrnPlBqQbObVavIGq2iZBvE3+jFfQ=; b=iLU6rkiCTX4lsSNj0QxZehIr/Klo4hRyY50ZVArchFz2NNNXNpOs8mLQmZbdCCk5Xx oxPB4lZbqfpN+qiiKuL7jCFAXugoFR4LfJbsTGT9FLrrM47nmMJKPfhc8r6l6cP2JNfG ycBctl1RqvuHQMIE5liYIg7MUTO8K7AgDMvxr+IMZjfc0t4ALNOGJQpzoRR5PhHVdSZf U3Dn/JCWLccx7MfE4xx5Sp226Z2sS5SY/HU3wZmJpDOCLCWGEMNTaLpB00HXlX26rskI 5PJ3wME6M/dF3M1EABDksHXAiaZWUqzAFXVCW8bMAyDp8LKKfWmQs5ZESb8lFRj5QC1k WVhQ== Received: by 10.180.102.40 with SMTP id fl8mr5149216wib.22.1355343911658; Wed, 12 Dec 2012 12:25:11 -0800 (PST) Received: from WorkStation.localnet (bzq-79-183-234-152.red.bezeqint.net. [79.183.234.152]) by mx.google.com with ESMTPS id l5sm7744157wia.10.2012.12.12.12.25.09 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 12:25:10 -0800 (PST) From: Ido Yariv To: Ohad Ben-Cohen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Cc: Ido Yariv Subject: [PATCH] hwspinlock/core: Fix unbalanced module_get on error path Date: Wed, 12 Dec 2012 22:24:57 +0200 Message-Id: <1355343897-17063-1-git-send-email-ido@wizery.com> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQkBZ/mTYoQNvxEUWU6PXFDSPjMZKlHAAiYdTLfUIlQyUZPNiOYutPIeUp7O+p3i7OUg8HYG Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org In case pm_runtime_get_sync() fails, __hwspin_lock_request will exit without calling module_put. As a result, the module could never be removed. Fix this. Signed-off-by: Ido Yariv --- drivers/hwspinlock/hwspinlock_core.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index db713c0..085e28e 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -415,6 +415,7 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) /* notify PM core that power is now needed */ ret = pm_runtime_get_sync(dev); if (ret < 0) { + module_put(dev->driver->owner); dev_err(dev, "%s: can't power on device\n", __func__); return ret; }