From patchwork Thu Mar 30 10:15:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9653565 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 39D2F60349 for ; Thu, 30 Mar 2017 10:16:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24FC628571 for ; Thu, 30 Mar 2017 10:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19B8928589; Thu, 30 Mar 2017 10:16:14 +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=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 975E728571 for ; Thu, 30 Mar 2017 10:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933311AbdC3KQM (ORCPT ); Thu, 30 Mar 2017 06:16:12 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35008 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933110AbdC3KQF (ORCPT ); Thu, 30 Mar 2017 06:16:05 -0400 Received: by mail-lf0-f65.google.com with SMTP id v2so4125252lfi.2; Thu, 30 Mar 2017 03:16:03 -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=0Hh/7/blhNdAX9kf8g+JXyAKuIdZHMo8ESAm8u/0EJ0=; b=R+q1eh6M5Uucl9qgG1Seg0M0V5BK9OkL32UecDgl7tLXQPkkzsMHY53DmKly2CfyTE bb/PA+4yh96AfrpnsfDIYcKU1e6j26gGL2vtCYqBhh/qb+3VUo6hyksQANWEGD0d1k5t hW5jn5/EW7nFFLB2P3H6BXZhEYLEkckbOXCvpNpJq8Bimh2xPLy2QQ/uov6pv3d7V7GS D2194H1Q4PkAIEoNfFC8xN964k7T2lXkmbZyShJMmvRjOqIybSUuIhK/+nS8FNpWUu9I 0Hu5IhNd+5sbzn4252Pub6hTPXqAAKKEzNESJJWftTYIOSCK1BBcqTzMa+RE8MxPxMaw y6Vw== 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=0Hh/7/blhNdAX9kf8g+JXyAKuIdZHMo8ESAm8u/0EJ0=; b=gnZkiXAQsZCPyPWkbSEG8xLktSpm8d/kXCThhGwC3ADVmRmHHXTPGUYNdRtH4z/jfH eJ1K+lNqNKzLasIwC3AdsJCIieyeqTyJsTYfg11Wa9E+cSXWyQZ9lU96Q1l0EIOHcA4X CzNTvQhrHZTbC5U1JJ3w+El3YgOLIdaTKc2HxZ2rTVjCZLTBOhD8D4GP4sAFXbYRfD8H EmvanuCSQph+4VjwiJA13fblCWW7BCMqtgIPVauGwyGD1ZsnyzU835Mxzl+fjxkWwJDP a+pRegmVZnNDFtWQk+6/qe1B0MMMR8oio5TuyNj3ZuXu446LrCfDsN6LlLgcDpSquGeh IEGA== X-Gm-Message-State: AFeK/H22ht6l+HtPJXQswOXF8Q35/nSBwN4EOKpfxhEnL/Ti5tJp4bEKINojF/QgRSXClA== X-Received: by 10.25.196.8 with SMTP id u8mr1479827lff.21.1490868962955; Thu, 30 Mar 2017 03:16:02 -0700 (PDT) Received: from xi.terra ([84.216.234.102]) by smtp.gmail.com with ESMTPSA id p27sm307458lfg.5.2017.03.30.03.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 03:16:01 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1ctX7R-00041L-Fo; Thu, 30 Mar 2017 12:15:53 +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 v2 5/8] NFC: nfcmrvl: fix firmware-management initialisation Date: Thu, 30 Mar 2017 12:15:39 +0200 Message-Id: <20170330101542.15384-6-johan@kernel.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170330101542.15384-1-johan@kernel.org> References: <20170330101542.15384-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 3e3fc9588f10..a446590a71ca 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -158,26 +158,28 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, goto error_free_gpio; } + 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_free_gpio: