From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C2BCC282C4 for ; Tue, 12 Feb 2019 08:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59E2D21773 for ; Tue, 12 Feb 2019 08:06:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JwKzOV4E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727603AbfBLIG2 (ORCPT ); Tue, 12 Feb 2019 03:06:28 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57076 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727428AbfBLIG2 (ORCPT ); Tue, 12 Feb 2019 03:06:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q7J8gFWKm2Lj0LvW4QbQYKl2vo1iI8p+6No8asPxDGk=; b=JwKzOV4E/2usH8e9+YjsYYGv7 wrlFjOrC5+myZv7yXqOJy6dNBZKdM+w6KPEdyGaPzVnilW+dXYC8fA1OnLofaKtGiISbucENSWevb nytlWonsSugFpLOnhhFJhjk5KlCcvBjL3aKF+UCzQINh+xHs51+61VIyE0qjK30DmkG4L7/VqZoMy TAKW8U7BlA4Gu/bsXr0KNTxj5RGp5s91+JlzEXAQzvnVRN84GvAQjbcVDLAKhSJ4QOfAO8BKgykLE vNK1aIIz6ZFCGMPGxpaYUAuVEYqMKIAxrtqtI0QwdXtk0TD+J4odMTVH9MRsIH5OGUimytkAwn3Mq QoNJig2EQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtT5I-0000F1-3j; Tue, 12 Feb 2019 08:06:28 +0000 Date: Tue, 12 Feb 2019 00:06:27 -0800 From: Christoph Hellwig To: "Ewan D. Milne" Cc: linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, stable@vger.kernel.org, james.smart@broadcom.com, dick.kennedy@broadcom.com, martin.petersen@oracle.com, jejb@linux.ibm.com Subject: Re: [PATCH] scsi: lpfc: fix calls to dma_set_mask_and_coherent() Message-ID: <20190212080627.GC10547@infradead.org> References: <20190211150502.9999-1-emilne@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190211150502.9999-1-emilne@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Feb 11, 2019 at 10:05:02AM -0500, Ewan D. Milne wrote: > The change to use dma_set_mask_and_coherent() incorrectly made a second > call with the 32 bit DMA mask value when the call with the 64 bit DMA > mask value succeeded. This resulted in NVMe/FC connections failing due > to corrupted data buffers, and various other SCSI/FCP I/O errors. Ooops, sorry. > /* Set the device DMA mask size */ > - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || > - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) > - return error; > + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0) > + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) But this still looks obsfuctating, why not: error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (error) error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))); if (error) return error;