Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751958AbbEGN7Y (ORCPT ); Thu, 7 May 2015 09:59:24 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:30946 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbbEGN7W (ORCPT ); Thu, 7 May 2015 09:59:22 -0400 Date: Thu, 7 May 2015 16:58:55 +0300 From: Dan Carpenter To: "J. German Rivera" Cc: gregkh@linuxfoundation.org, arnd@arndb.de, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, stuart.yoder@freescale.com, bhupesh.sharma@freescale.com, agraf@suse.de, bhamciu1@freescale.com, nir.erez@freescale.com, itai.katz@freescale.com, scottwood@freescale.com, R89243@freescale.com, richard.schmitt@freescale.com Subject: Re: [PATCH v2 1/7] staging: fsl-mc: MC bus IRQ support Message-ID: <20150507135854.GJ14154@mwanda> References: <1430947708-10521-1-git-send-email-German.Rivera@freescale.com> <1430947708-10521-2-git-send-email-German.Rivera@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1430947708-10521-2-git-send-email-German.Rivera@freescale.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2009 Lines: 71 On Wed, May 06, 2015 at 04:28:22PM -0500, J. German Rivera wrote: > @@ -350,17 +324,280 @@ int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) > * Discover objects in the DPRC: > */ > mutex_lock(&mc_bus->scan_mutex); > - error = dprc_scan_objects(mc_bus_dev); > + error = dprc_scan_objects(mc_bus_dev, &irq_count); > mutex_unlock(&mc_bus->scan_mutex); > if (error < 0) > - goto error; > + return error; > + > + if (!mc_bus->irq_resources) { This can never be true. It confused me for a while because otherwise it looks like there is an obvious bug here. I also think dprc_scan_container() should be named something alloc because that's really what it does. > + irq_count += FSL_MC_IRQ_POOL_MAX_EXTRA_IRQS; > + error = fsl_mc_populate_irq_pool(mc_bus, irq_count); > + if (error < 0) > + return error; > + } > + > + return 0; > +} [ snip ] > @@ -415,10 +652,20 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) > if (error < 0) > goto error_cleanup_open; > > + /* > + * Configure interrupts for the DPRC object associated with this MC bus: > + */ > + error = dprc_setup_irqs(mc_dev); > + if (error < 0) > + goto error_cleanup_open; > + > dev_info(&mc_dev->dev, "DPRC device bound to driver"); > return 0; > > error_cleanup_open: > + if (mc_bus->irq_resources) > + fsl_mc_cleanup_irq_pool(mc_bus); This isn't beautiful beause we're not cleaning up open here. We're de-allocating dprc_scan_container(). Introduce a new label, and remove the if statement so it looks like this: error_free_scan: unscan_the_container(mc_bus); error_cleanup_open: (void)dprc_close(mc_dev->mc_io, mc_dev->mc_handle); > + > (void)dprc_close(mc_dev->mc_io, mc_dev->mc_handle); > > error_cleanup_mc_io: regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/