From patchwork Sat Jan 28 13:31:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9543283 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 552C460415 for ; Sat, 28 Jan 2017 13:32:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4546E27F82 for ; Sat, 28 Jan 2017 13:32:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 377C227FBB; Sat, 28 Jan 2017 13:32:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C22B727F82 for ; Sat, 28 Jan 2017 13:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751205AbdA1Ncz (ORCPT ); Sat, 28 Jan 2017 08:32:55 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:33523 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbdA1Ncw (ORCPT ); Sat, 28 Jan 2017 08:32:52 -0500 Received: by mail-lf0-f65.google.com with SMTP id x1so28035588lff.0 for ; Sat, 28 Jan 2017 05:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=INdcI1X6LpRjKFb/9VHg+u2qgHiigxDkZNJNhLifKaY=; b=XjhtlH62zpWpYlD7QmGSWHs++U7cwFzuodf0XlnrzgCkFqpON6+Aohzt868zLVqt8q aFT2CviqToQUG1nTxbGDbYSn/hSVxMg7l8ArTuSttQIwCrfVLDjpps11DvuGxkZP3f5L q6Yi5udZTNJXDvBTTsHvd3n+gN75A8m4ibwSl+KFmwjOvEI8UfmEPTL4WR7RqS4UiLFF GMHZtfEGyFAmlI/b3HWKNpDbhKnp9UXY0i9FOztZCVv/baiey1Afl/n2xN+N0ga8WIZD O1SubxROP5FCckfqtk4I9dZ4IMapkOgfGkkrzCJzKvB+8C5WSwxx4jSw+itzYuCr7b1h m43g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=INdcI1X6LpRjKFb/9VHg+u2qgHiigxDkZNJNhLifKaY=; b=YJIr4U3Yg/Y0Fy9mfSxj0hp5C8J0S7SagAZdpORnOtT7VyT7cgtBpFSfsbRYvOAy7e JtwZAAS0zdKpeOHGJB4INCa35fulsoJztRUaNqV91nAlJfD4P6JKvTrRPBVrhvUduD2r cVXDju9Uxg4mnI7cXOBwpxUMnfFVq1iLl0PZICLcatTbkfLAYdE9OpN2xJgKpmaE0P8S xUagayDprOy2dhy+3Hi4Y/Go/cOBMlMpT2l1tABDidzQYAcFBTTsPdt3T4TLqUfgHvjC zhO/Nig4r9EMYLlt/UaME9+09FIfF9vdulmw7jeH29OAh1vttUCvXfbR91M8fYUQv1uq 48mQ== X-Gm-Message-State: AIkVDXLHvXxIBebEVcuQROMfcHaq2/5LsaJCnEgsQID1zXQlmwZq2aXkp3t3QZrL0kJX6w== X-Received: by 10.25.129.147 with SMTP id c141mr4217591lfd.93.1485610292409; Sat, 28 Jan 2017 05:31:32 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id a138sm2071339lfb.2.2017.01.28.05.31.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Jan 2017 05:31:31 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo , linux-wireless@vger.kernel.org Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH fix?] bcma: use (get|put)_device when probing/removing device driver Date: Sat, 28 Jan 2017 14:31:22 +0100 Message-Id: <20170128133122.12360-1-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafał Miłecki This allows tracking device state and e.g. makes devm work as expected. Signed-off-by: Rafał Miłecki Cc: Stable --- Kalle: this issue is in bcma since /ever/, so I'm Cc-ing stable without pointing any version. If someone reviewes (you or anyone) you may consider taking it as 3.10 fix. Can someone confirm this patch is OK? --- drivers/bcma/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 2c1798e38abd..38688236b3cd 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -633,8 +633,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; } @@ -647,6 +650,7 @@ static int bcma_device_remove(struct device *dev) if (adrv->remove) adrv->remove(core); + put_device(dev); return 0; }