All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Ching Huang <ching2048@areca.com.tw>
Cc: hch@infradead.org, thenzl@redhat.com, jbottomley@parallels.com,
	dan.carpenter@oracle.com, agordeev@redhat.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	hch@lst.de
Subject: Re: [PATCH 2/2] arcmsr: adds code for support areca new adapter ARC1203
Date: Tue, 24 Nov 2015 02:24:34 -0800	[thread overview]
Message-ID: <1448360674.20113.5.camel@perches.com> (raw)
In-Reply-To: <1448358798.14472.3.camel@Centos6.3-64>

On Tue, 2015-11-24 at 17:53 +0800, Ching Huang wrote:
> On Tue, 2015-11-24 at 01:33 -0800, Joe Perches wrote:
> > On Tue, 2015-11-24 at 16:17 +0800, Ching Huang wrote:
> > > From: Ching Huang <ching2048@areca.com.tw>
> > > 
> > > Support areca new PCIe to SATA RAID adapter ARC1203
> > 
> > Why add the dma_free_coherent to an old data path?
> > Is that a general bug fix that should be backported?
> 
> That's right. It's need to release the allocated resource for failed
> condition.

Then the dma_free_coherent addition should be a separate patch.

Style trivia:

The goto to another error path like that is odd and
the label is unintelligible.

Ideally error condition handling would use a goto and
a separate and obviously named label.  Use multiple
labels for cases with more complicated unwinding.

Dan Carpenter has written about this several times.

For this use, something like:

	writel(ARCMSR_MESSAGE_START_DRIVER_MODE, reg->drv2iop_doorbell);
	if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
		logging_message(...);
		goto
err_free_resource;
	}
	writel(ARCMSR_MESSAGE_GET_CONFIG, reg->drv2iop_doorbell);
	if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
		logging_message(...);
		goto err_free_resource;
	}

	[success path...]

	return true;

err_free_resource:
	dma_free_coherent(...);

	return false;
}

  reply	other threads:[~2015-11-24 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24  8:17 [PATCH 2/2] arcmsr: adds code for support areca new adapter ARC1203 Ching Huang
2015-11-24  9:33 ` Joe Perches
2015-11-24  9:33   ` Joe Perches
2015-11-24  9:53   ` Ching Huang
2015-11-24  9:53     ` Ching Huang
2015-11-24 10:24     ` Joe Perches [this message]
2015-11-24 11:20       ` Ching Huang

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=1448360674.20113.5.camel@perches.com \
    --to=joe@perches.com \
    --cc=agordeev@redhat.com \
    --cc=ching2048@areca.com.tw \
    --cc=dan.carpenter@oracle.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=thenzl@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.