From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754393AbbKXKYm (ORCPT ); Tue, 24 Nov 2015 05:24:42 -0500 Received: from smtprelay0021.hostedemail.com ([216.40.44.21]:60241 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754369AbbKXKYi (ORCPT ); Tue, 24 Nov 2015 05:24:38 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 20,1.5,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3871:3872:3874:4321:4385:5007:6119:6261:7576:10009:10400:10848:11026:11232:11473:11658:11914:12043:12438:12517:12519:12534:12679:12740:13069:13161:13229:13311:13357:14659:21080:30012:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:1:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: milk72_6261c0318c74e X-Filterd-Recvd-Size: 2360 Message-ID: <1448360674.20113.5.camel@perches.com> Subject: Re: [PATCH 2/2] arcmsr: adds code for support areca new adapter ARC1203 From: Joe Perches To: Ching Huang 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 Date: Tue, 24 Nov 2015 02:24:34 -0800 In-Reply-To: <1448358798.14472.3.camel@Centos6.3-64> References: <1448353024.12861.56.camel@Centos6.3-64> <1448357586.14504.12.camel@perches.com> <1448358798.14472.3.camel@Centos6.3-64> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.5-1ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > > > 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; }