From patchwork Sun Jan 17 22:17:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 73555 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0HMHpLt027800 for ; Sun, 17 Jan 2010 22:17:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753834Ab0AQWRs (ORCPT ); Sun, 17 Jan 2010 17:17:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752857Ab0AQWRr (ORCPT ); Sun, 17 Jan 2010 17:17:47 -0500 Received: from fg-out-1718.google.com ([72.14.220.155]:7405 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753515Ab0AQWRr (ORCPT ); Sun, 17 Jan 2010 17:17:47 -0500 Received: by fg-out-1718.google.com with SMTP id 22so468482fge.1 for ; Sun, 17 Jan 2010 14:17:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:received:received :from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; bh=YYdmM0BMcW3wXgxvVZ1ATDs7lt1NfUO2npaPchahxyY=; b=sqng4VQhfrnCdHNN3+q1bnRZgBEIwEUtOiRTt+HAa0+mrx1kuhSoGW2XgrxVvHBe/h kJBOvyxOSVIk+2PqP80XbsMYEGySX0hRz35TyYC3ddjb0yPI7ej9CzyS9dV8csGk7riD dIKb7ZiEO6ybts95op1F5XKY6isXw1hvMwnUs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; b=VYJkhuM4N7K54jSEBtSMlJ6ksjY/0rG40DKO2gAbBeigtaBLCF4V/dmNXylNusqTeX O+Mm8cZLVHr85F42NJXld3+PmAXWIlqiRijtF+4yZ+dpb5bXqxh6fvi2iQMUbw5o00QL abSjtfdz1l0F2FLTz2Q/f6dR15sEhDcx2dg6I= Received: by 10.87.48.11 with SMTP id a11mr1431015fgk.36.1263766656674; Sun, 17 Jan 2010 14:17:36 -0800 (PST) Received: from blech.mobile (nat-wh.rz.uni-karlsruhe.de [129.13.72.197]) by mx.google.com with ESMTPS id e20sm9799031fga.12.2010.01.17.14.17.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 17 Jan 2010 14:17:36 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by blech.mobile (Postfix) with ESMTP id 000D034114C; Sun, 17 Jan 2010 23:17:34 +0100 (CET) Received: from blech.mobile ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E4zZbGP8id36; Sun, 17 Jan 2010 23:17:30 +0100 (CET) Received: from blech.mobile (localhost [127.0.0.1]) by blech.mobile (Postfix) with ESMTP id 9E32534111E; Sun, 17 Jan 2010 23:17:30 +0100 (CET) From: Christian Lamparter To: linux-wireless@vger.kernel.org Subject: [PATCH] p54pci: handle dma mapping errors Date: Sun, 17 Jan 2010 23:17:29 +0100 User-Agent: KMail/1.12.4 (Linux/2.6.33-rc3-x-wl; KDE/4.3.4; x86_64; ; ) Cc: John W Linville MIME-Version: 1.0 Message-Id: <201001172317.29783.chunkeey@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index a15962a..7446373 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c @@ -157,6 +157,14 @@ static void p54p_refill_rx_ring(struct ieee80211_hw *dev, skb_tail_pointer(skb), priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); + + if (pci_dma_mapping_error(priv->pdev, mapping)) { + dev_kfree_skb_any(skb); + dev_err(&priv->pdev->dev, + "RX DMA Mapping error\n"); + break; + } + desc->host_addr = cpu_to_le32(mapping); desc->device_addr = 0; // FIXME: necessary? desc->len = cpu_to_le16(priv->common.rx_mtu + 32); @@ -317,14 +325,20 @@ static void p54p_tx(struct ieee80211_hw *dev, struct sk_buff *skb) u32 device_idx, idx, i; spin_lock_irqsave(&priv->lock, flags); - device_idx = le32_to_cpu(ring_control->device_idx[1]); idx = le32_to_cpu(ring_control->host_idx[1]); i = idx % ARRAY_SIZE(ring_control->tx_data); - priv->tx_buf_data[i] = skb; mapping = pci_map_single(priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); + if (pci_dma_mapping_error(priv->pdev, mapping)) { + spin_unlock_irqrestore(&priv->lock, flags); + p54_free_skb(dev, skb); + dev_err(&priv->pdev->dev, "TX DMA mapping error\n"); + return ; + } + priv->tx_buf_data[i] = skb; + desc = &ring_control->tx_data[i]; desc->host_addr = cpu_to_le32(mapping); desc->device_addr = ((struct p54_hdr *)skb->data)->req_id;