From patchwork Tue Aug 8 13:55:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 9888343 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 94C9260384 for ; Tue, 8 Aug 2017 13:56:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 866C7288E7 for ; Tue, 8 Aug 2017 13:56:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79877288F1; Tue, 8 Aug 2017 13:56: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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 423C9288E7 for ; Tue, 8 Aug 2017 13:56:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbdHHN4A (ORCPT ); Tue, 8 Aug 2017 09:56:00 -0400 Received: from m12-17.163.com ([220.181.12.17]:57222 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752092AbdHHNz7 (ORCPT ); Tue, 8 Aug 2017 09:55:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=3g9JyqMqSOw/Czq4bb SuFC1mreiQNAeGBNUwfKytWUo=; b=R6G9AZiLYBVQIgj/yPVN7U1MiW3Zu9KRMV An85a80T7hQ9Y6a/nNvvtHrx4Xb7dT5yT8Fk9sWxaXpceNb+f7k8BO9Fg+n10nFb s5vMq9jB33gxxDL1+wpBTbMKDsgcUGuvEBta9tMCrAzjsgtmVhvg5PrYaFLBWKfO 12NLbrY74= Received: from localhost.localdomain (unknown [106.120.213.62]) by smtp13 (Coremail) with SMTP id EcCowADXc8HewolZdmp5DQ--.45488S3; Tue, 08 Aug 2017 21:55:45 +0800 (CST) From: Pan Bian To: qla2xxx-upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: scsi: qla2xxx: use dma_mapping_error to check map errors Date: Tue, 8 Aug 2017 21:55:30 +0800 Message-Id: <1502200531-15219-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: EcCowADXc8HewolZdmp5DQ--.45488S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gry8Wr47XrW8CFy3Gr1UAwb_yoWfWFc_ur WUZrW7XFsakr17Xwn2qF93J3yS9rW8Xr4F9F109a43C34ruw13ZryvvFykZan7W3yUuFWD Ca1UZrWrZr18WjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnP73DUUUUU== X-Originating-IP: [106.120.213.62] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBZwEucletmx5MIAAAsp Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The return value of dma_map_single() should be checked by dma_mapping_error(). However, in function qla26xx_dport_diagnostics(), its return value is checked against NULL, which could result in failures. Signed-off-by: Pan Bian Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 7c6d1a4..eafb709 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -5817,7 +5817,7 @@ struct cs84xx_mgmt_cmd { dd_dma = dma_map_single(&vha->hw->pdev->dev, dd_buf, size, DMA_FROM_DEVICE); - if (!dd_dma) { + if (dma_mapping_error(&vha->hw->pdev->dev, dd_dma)) { ql_log(ql_log_warn, vha, 0x1194, "Failed to map dma buffer.\n"); return QLA_MEMORY_ALLOC_FAILED; }