stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Ewan D. Milne" <emilne@redhat.com>
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()
Date: Tue, 12 Feb 2019 00:06:27 -0800	[thread overview]
Message-ID: <20190212080627.GC10547@infradead.org> (raw)
In-Reply-To: <20190211150502.9999-1-emilne@redhat.com>

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;

  parent reply	other threads:[~2019-02-12  8:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 15:05 [PATCH] scsi: lpfc: fix calls to dma_set_mask_and_coherent() Ewan D. Milne
2019-02-11 19:19 ` James Smart
2019-02-12  8:06 ` Christoph Hellwig [this message]
2019-02-12 15:37   ` Ewan D. Milne
2019-02-12 18:34     ` Christoph Hellwig
2019-02-13  3:10     ` Martin K. Petersen
2019-02-13  9:18       ` John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190212080627.GC10547@infradead.org \
    --to=hch@infradead.org \
    --cc=dick.kennedy@broadcom.com \
    --cc=emilne@redhat.com \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).