From patchwork Wed Mar 29 16:21:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9651915 X-Patchwork-Delegate: sameo@linux.intel.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 16F6060349 for ; Wed, 29 Mar 2017 16:23:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B31B28485 for ; Wed, 29 Mar 2017 16:23:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0027A284F2; Wed, 29 Mar 2017 16:23:13 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 C39E928485 for ; Wed, 29 Mar 2017 16:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753441AbdC2QWB (ORCPT ); Wed, 29 Mar 2017 12:22:01 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33274 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753174AbdC2QV7 (ORCPT ); Wed, 29 Mar 2017 12:21:59 -0400 Received: by mail-lf0-f68.google.com with SMTP id r36so2176585lfi.0; Wed, 29 Mar 2017 09:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=gHzGZFk4kZof+zctl4ALaCPdkgRV/5YlQAQXt1QGwag=; b=Nmb/mERf7e5ZP+JnXc7xY0X3xgF900L2nWrvbg9eGYJQwBTNePjGQWwO+K0BQI2nzU utn9OgF/PVSj38CzKxr+3UYVaF4IB1EX4t1wMNIQDPlwCgNYb9cO+ei9efYVE1iu/VhG scSVzkmXCDurMXCgcpn1dYVeUV7q/V63XDqXc969sp+ww2D72g1gfnvKeMnf1nq6vysO isRcCi6lA5NAiMv/SzJ5dhOO7KcJWHsRWPVeb+qjV50yQPL5iAxBjwV07pGLE+wVo8lv 4OErlX8hb1wcduETLrErBlDKnc8qlKgsH8BbETUEM5f1xxfQgEnjY0Kgn5bPoAOAsR7N yY7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=gHzGZFk4kZof+zctl4ALaCPdkgRV/5YlQAQXt1QGwag=; b=WIzlnd49Fd+eoAETNA/oub9arx/jGMVhIlb15v8fjNoXIvWGc53KQyu9CkfdkN0/zg +I9NOIWGmrMGH6OEy7AYc88pumWXhs9NU1+00fRy7zN8HBz+ofRvrvRgkU+uBfQnTi8r ytyMjEOk6VkD3uv6Zq70POZUBm3gEUsRm95Y4zamEQ72gJwgWcCrG9nmDYlT+LJtqb1K wAGaN7qmq8dpwcM22tJz8ujA6zzURVY0PRUqVHKPuCvmtZ3hO3taQ0ehWJQKW7jeXTWO Ey0HumYDoU0OoyxImTtGCS3BL4n43KwfzpJG71atLCCSZRb9lcjkzNVeFy6gP58aehkK FC6A== X-Gm-Message-State: AFeK/H0AfhBM/sROg1pKYWg35SQq/KtzMJuWC/l6D4qxPXmMKb0xnjhpK8DF/hdhCcfVKA== X-Received: by 10.25.149.74 with SMTP id x71mr447074lfd.100.1490804516314; Wed, 29 Mar 2017 09:21:56 -0700 (PDT) Received: from xi.terra ([84.216.234.102]) by smtp.gmail.com with ESMTPSA id u16sm1396534ljd.6.2017.03.29.09.21.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2017 09:21:54 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1ctGM1-0004jT-3k; Wed, 29 Mar 2017 18:21:49 +0200 From: Johan Hovold To: Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Vincent Cuissard Subject: [PATCH 5/7] NFC: nfcmrvl: fix firmware-management initialisation Date: Wed, 29 Mar 2017 18:21:10 +0200 Message-Id: <20170329162112.18121-6-johan@kernel.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170329162112.18121-1-johan@kernel.org> References: <20170329162112.18121-1-johan@kernel.org> 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 The nci-device was never deregistered in the event that fw-initialisation failed. Fix this by moving the firmware initialisation before device registration since the firmware work queue should be available before registering. Note that this depends on a recent fix that moved device-name initialisation back to to nci_allocate_device() as the firmware-workqueue name is now derived from the nfc-device name. Fixes: 3194c6870158 ("NFC: nfcmrvl: add firmware download support") Cc: stable # 4.4 Cc: Vincent Cuissard Signed-off-by: Johan Hovold --- drivers/nfc/nfcmrvl/main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index 8d4294fc3005..f20220bab6b6 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -156,26 +156,28 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, goto error; } + rc = nfcmrvl_fw_dnld_init(priv); + if (rc) { + nfc_err(dev, "failed to initialize FW download %d\n", rc); + goto error_free_dev; + } + nci_set_drvdata(priv->ndev, priv); rc = nci_register_device(priv->ndev); if (rc) { nfc_err(dev, "nci_register_device failed %d\n", rc); - goto error_free_dev; + goto error_fw_dnld_deinit; } /* Ensure that controller is powered off */ nfcmrvl_chip_halt(priv); - rc = nfcmrvl_fw_dnld_init(priv); - if (rc) { - nfc_err(dev, "failed to initialize FW download %d\n", rc); - goto error_free_dev; - } - nfc_info(dev, "registered with nci successfully\n"); return priv; +error_fw_dnld_deinit: + nfcmrvl_fw_dnld_deinit(priv); error_free_dev: nci_free_device(priv->ndev); error: