From patchwork Tue Apr 4 05:09:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 9660857 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 95257602B5 for ; Tue, 4 Apr 2017 05:18:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D6502832B for ; Tue, 4 Apr 2017 05:18:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70D7028473; Tue, 4 Apr 2017 05:18:17 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 AC11E2832B for ; Tue, 4 Apr 2017 05:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751094AbdDDFSO (ORCPT ); Tue, 4 Apr 2017 01:18:14 -0400 Received: from rere.qmqm.pl ([84.10.57.10]:59980 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751064AbdDDFSN (ORCPT ); Tue, 4 Apr 2017 01:18:13 -0400 X-Greylist: delayed 541 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 Apr 2017 01:18:13 EDT Received: by rere.qmqm.pl (Postfix, from userid 1000) id 855786178; Tue, 4 Apr 2017 07:09:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1491282550; bh=u8rcTudHPPwjRo057I8qVtWSI3TM6J8QAyhS9miTYj0=; h=From:Subject:To:Cc:Date:From; b=EcFu2d2NMN7Dsx+uhWImp1BTY+ke72rdNdOt7VE2Ps0qsNd7XBQeNjGSpD/lVdiAe yxjX04PaHnpoaRYf5Jt1tNOWTLR5XfSZVtwu2RB3p4/mGo7Uga6nO9Y2bphI4//JHd psTUTGy6Spes7RpQpBXbExGsU1uPMhl6fftS729e8kghl8Zal1disLtLSNiTZv0e7y +U+PLSOsYPErBvCPAXPCteKvyblegz2/zFbctzFoAv0sS8f5Tj4hkh8TqUWB35wWnO 0gCKi8jeV7xRsOufNffeKKiPphfUHSQtu21nvh86TZ1A52ajU3MwAKD9lOFNpH3lCP Iw7n6OB+DD9XA== Message-Id: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH] NFC: pn533: use constant off-stack buffer for sending acks MIME-Version: 1.0 To: linux-wireless@vger.kernel.org Cc: Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz , Michael Thalmeier Date: Tue, 4 Apr 2017 07:09:10 +0200 (CEST) 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 This fixes following WARNing: usb 3-2.4.1: NFC: Exchanging data failed (error 0x13) llcp: nfc_llcp_recv: err -5 llcp: nfc_llcp_symm_timer: SYMM timeout ------------[ cut here ]------------ WARNING: CPU: 1 PID: 26397 at .../drivers/usb/core/hcd.c:1584 usb_hcd_map_urb_for_dma+0x370/0x550 transfer buffer not dma capable [...] Workqueue: events nfc_llcp_timeout_work [nfc] Call Trace: ? dump_stack+0x46/0x5a ? __warn+0xb9/0xe0 ? warn_slowpath_fmt+0x5a/0x80 ? usb_hcd_map_urb_for_dma+0x370/0x550 ? usb_hcd_submit_urb+0x2fb/0xa60 ? dequeue_entity+0x3f2/0xc30 ? pn533_usb_send_ack+0x5d/0x80 [pn533_usb] ? pn533_usb_abort_cmd+0x13/0x20 [pn533_usb] ? pn533_dep_link_down+0x32/0x70 [pn533] ? nfc_dep_link_down+0x87/0xd0 [nfc] [...] usb 3-2.4.1: NFC: Exchanging data failed (error 0x13) llcp: nfc_llcp_recv: err -5 llcp: nfc_llcp_symm_timer: SYMM timeout Signed-off-by: Michał Mirosław --- Patch against stable linux-4.10.8. --- drivers/nfc/pn533/i2c.c | 7 ++++--- drivers/nfc/pn533/usb.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c index 1dc89248e58e..35f410797fe4 100644 --- a/drivers/nfc/pn533/i2c.c +++ b/drivers/nfc/pn533/i2c.c @@ -49,10 +49,11 @@ struct pn533_i2c_phy { static int pn533_i2c_send_ack(struct pn533 *dev, gfp_t flags) { - struct pn533_i2c_phy *phy = dev->phy; - struct i2c_client *client = phy->i2c_dev; - u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; + static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; /* spec 6.2.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ + + struct pn533_i2c_phy *phy = dev->phy; + struct i2c_client *client = phy->i2c_dev; int rc; rc = i2c_master_send(client, ack, 6); diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 33ed78be2750..09e1db8e8dc3 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -147,12 +147,13 @@ static int pn533_submit_urb_for_ack(struct pn533_usb_phy *phy, gfp_t flags) static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags) { - struct pn533_usb_phy *phy = dev->phy; - u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; + static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; /* spec 7.1.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ + + struct pn533_usb_phy *phy = dev->phy; int rc; - phy->out_urb->transfer_buffer = ack; + phy->out_urb->transfer_buffer = (u8 *)ack; phy->out_urb->transfer_buffer_length = sizeof(ack); rc = usb_submit_urb(phy->out_urb, flags);