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: 1870261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 16FDC3FC71 for ; Wed, 12 Dec 2012 20:28:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tisrn-0006Kf-1Z; Wed, 12 Dec 2012 20:25:19 +0000 Received: from mail-we0-f169.google.com ([74.125.82.169]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tisri-0006KN-JF for linux-arm-kernel@lists.infradead.org; Wed, 12 Dec 2012 20:25:15 +0000 Received: by mail-we0-f169.google.com with SMTP id t49so534886wey.0 for ; Wed, 12 Dec 2012 12:25:11 -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=YvbyndYfzWP3M9irNt1lrGGE9h3DLwXTgAlh2aRNhoZxuXmCvAHjK0X0IGW/rPso7e jS3/4QvCPspqVSedjHJjJiQNPRA4lMbQkofdY3mjECNV1sZGPnHdvy2O+oJuNjx5JvkK uQ5gj1lJzQhgBFKcFxQCXMQSwCG3Il1y1f1YZwb4e52d5qWyLKEAWfl2f+mDj2Z1Wo7H MUBTNs9sB3n29i29SWeubHgCk77sd/B/9+yaqbkYSOJZhA21dRlip3h4iiphqbXROJR5 SGrvEg/PGzsTuqwiGlxos2cX4hDIespYjONdZj/1GuyPrXfmuDGaI6QrmAouqgBFpBf4 9ebA== 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 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: ALoCoQmSkm53gePt7RsKzUziXBR3Hmw8MQC6lz6fJMF0+SEczVapD2HyUj2wbdecImkzLQ8ns8np X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121212_152514_778201_F108CC93 X-CRM114-Status: GOOD ( 10.94 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.169 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Ido Yariv X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }