Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753044AbdFSTcz (ORCPT + 2 others); Mon, 19 Jun 2017 15:32:55 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:51950 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbdFSSew (ORCPT ); Mon, 19 Jun 2017 14:34:52 -0400 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: =?latin1?q?Rafa=C5=82=20Mi=C5=82ecki?= , Kalle Valo , Willy Tarreau Subject: [PATCH 3.10 162/268] bcma: use (get|put)_device when probing/removing device driver Date: Mon, 19 Jun 2017 20:31:01 +0200 Message-Id: <1497897167-14556-163-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1497897167-14556-1-git-send-email-w@1wt.eu> References: <1497897167-14556-1-git-send-email-w@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=latin1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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: Willy Tarreau --- drivers/bcma/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index f72f52b..65e3687 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -432,8 +432,11 @@ static int bcma_device_probe(struct device *dev) drv); int err = 0; + get_device(dev); if (adrv->probe) err = adrv->probe(core); + if (err) + put_device(dev); return err; } @@ -446,6 +449,7 @@ static int bcma_device_remove(struct device *dev) if (adrv->remove) adrv->remove(core); + put_device(dev); return 0; } -- 2.8.0.rc2.1.gbe9624a