From patchwork Wed Apr 20 09:16:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104943 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2333516qge; Wed, 20 Apr 2016 02:17:00 -0700 (PDT) X-Received: by 10.98.80.78 with SMTP id e75mr10735964pfb.147.1461143819965; Wed, 20 Apr 2016 02:16:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc9si3641411pac.174.2016.04.20.02.16.59; Wed, 20 Apr 2016 02:16:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754194AbcDTJQ5 (ORCPT + 29 others); Wed, 20 Apr 2016 05:16:57 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:56472 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752624AbcDTJQx (ORCPT ); Wed, 20 Apr 2016 05:16:53 -0400 Received: from debutante.sirena.org.uk ([2a01:348:6:8808:fab::3] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1asoFa-0002Mt-VP; Wed, 20 Apr 2016 09:16:47 +0000 Received: from broonie by debutante with local (Exim 4.87) (envelope-from ) id 1asoFT-0007zM-I2; Wed, 20 Apr 2016 10:16:39 +0100 From: Mark Brown To: Greg Kroah-Hartman Cc: Srinivas Kandagatla , Andrew Lunn , linux-kernel@vger.kernel.org, Mark Brown Date: Wed, 20 Apr 2016 10:16:35 +0100 Message-Id: <1461143796-30669-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.8.0.rc3 X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 Subject: [PATCH 1/2] eeprom: at25: Fix SPI device leak X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The at25 driver is using spi_dev_get() apparently just to take a copy of the SPI device used to instantiate it but never calls spi_dev_put() to free it. Since the device is guaranteed to exist between probe() and remove() there should be no need for the driver to take an extra reference to it so fix the leak by just using a straight assignment. Signed-off-by: Mark Brown --- drivers/misc/eeprom/at25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.0.rc3 diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index fa36a6e37084..a8ec227a7ff9 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -390,7 +390,7 @@ static int at25_probe(struct spi_device *spi) mutex_init(&at25->lock); at25->chip = chip; - at25->spi = spi_dev_get(spi); + at25->spi = spi; spi_set_drvdata(spi, at25); at25->addrlen = addrlen; From patchwork Wed Apr 20 09:16:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104942 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2333649qge; Wed, 20 Apr 2016 02:17:20 -0700 (PDT) X-Received: by 10.66.183.230 with SMTP id ep6mr10815194pac.89.1461143840787; Wed, 20 Apr 2016 02:17:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s73si2668932pfs.11.2016.04.20.02.17.20; Wed, 20 Apr 2016 02:17:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753877AbcDTJQ4 (ORCPT + 29 others); Wed, 20 Apr 2016 05:16:56 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:56470 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753036AbcDTJQx (ORCPT ); Wed, 20 Apr 2016 05:16:53 -0400 Received: from debutante.sirena.org.uk ([2a01:348:6:8808:fab::3] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1asoFX-0002Ms-AW; Wed, 20 Apr 2016 09:16:44 +0000 Received: from broonie by debutante with local (Exim 4.87) (envelope-from ) id 1asoFT-0007zP-Iv; Wed, 20 Apr 2016 10:16:39 +0100 From: Mark Brown To: Greg Kroah-Hartman Cc: Srinivas Kandagatla , Andrew Lunn , linux-kernel@vger.kernel.org, Mark Brown Date: Wed, 20 Apr 2016 10:16:36 +0100 Message-Id: <1461143796-30669-2-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1461143796-30669-1-git-send-email-broonie@kernel.org> References: <1461143796-30669-1-git-send-email-broonie@kernel.org> X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 Subject: [PATCH 2/2] eeprom: 93xx46: Fix SPI device leak X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 93xx46 driver is using spi_dev_get() apparently just to take a copy of the SPI device used to instantiate it but never calls spi_dev_put() to free it. Since the device is guaranteed to exist between probe() and remove() there should be no need for the driver to take an extra reference to it so fix the leak by just using a straight assignment. Signed-off-by: Mark Brown --- drivers/misc/eeprom/eeprom_93xx46.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.0.rc3 diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index 426fe2fd5238..d971ae9eefde 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -511,7 +511,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi) mutex_init(&edev->lock); - edev->spi = spi_dev_get(spi); + edev->spi = spi; edev->pdata = pd; edev->size = 128;