From patchwork Wed Apr 20 11:54:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104941 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2400461qge; Wed, 20 Apr 2016 04:54:16 -0700 (PDT) X-Received: by 10.98.67.143 with SMTP id l15mr3180426pfi.114.1461153256268; Wed, 20 Apr 2016 04:54:16 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hr6si18179094pac.38.2016.04.20.04.54.15; Wed, 20 Apr 2016 04:54:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932917AbcDTLyO (ORCPT + 4 others); Wed, 20 Apr 2016 07:54:14 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:56704 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751751AbcDTLyN (ORCPT ); Wed, 20 Apr 2016 07:54:13 -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 1asqhu-0002ht-UO; Wed, 20 Apr 2016 11:54:11 +0000 Received: from broonie by debutante with local (Exim 4.87) (envelope-from ) id 1asqhq-00025a-CW; Wed, 20 Apr 2016 12:54:06 +0100 From: Mark Brown To: Florian Fainelli Cc: netdev@vger.kernel.org, Mark Brown Date: Wed, 20 Apr 2016 12:54:05 +0100 Message-Id: <1461153245-7992-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] net: phy: spi_ks8895: Don't leak references to SPI devices 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The ks8895 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/net/phy/spi_ks8995.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.0.rc3 diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c index b5d50d458728..93ffedfa2994 100644 --- a/drivers/net/phy/spi_ks8995.c +++ b/drivers/net/phy/spi_ks8995.c @@ -441,7 +441,7 @@ static int ks8995_probe(struct spi_device *spi) return -ENOMEM; mutex_init(&ks->lock); - ks->spi = spi_dev_get(spi); + ks->spi = spi; ks->chip = &ks8995_chip[variant]; if (ks->spi->dev.of_node) {