Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752170AbdFAQ2F (ORCPT ); Thu, 1 Jun 2017 12:28:05 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:33375 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751930AbdFAPos (ORCPT ); Thu, 1 Jun 2017 11:44:48 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=" , "Kalle Valo" Date: Thu, 01 Jun 2017 16:43:16 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 085/212] bcma: use (get|put)_device when probing/removing device driver In-Reply-To: X-SA-Exim-Connect-IP: 82.70.136.246 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 898 Lines: 39 3.16.44-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Rafał Miłecki commit a971df0b9d04674e325346c17de9a895425ca5e1 upstream. This allows tracking device state and e.g. makes devm work as expected. Signed-off-by: Rafał Miłecki Signed-off-by: Kalle Valo Signed-off-by: Ben Hutchings --- drivers/bcma/main.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -450,8 +450,11 @@ static int bcma_device_probe(struct devi drv); int err = 0; + get_device(dev); if (adrv->probe) err = adrv->probe(core); + if (err) + put_device(dev); return err; } @@ -464,6 +467,7 @@ static int bcma_device_remove(struct dev if (adrv->remove) adrv->remove(core); + put_device(dev); return 0; }