From: Dan Carpenter <dan.carpenter@oracle.com>
To: "J. German Rivera" <German.Rivera@freescale.com>
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
Date: Thu, 7 May 2015 16:58:55 +0300 [thread overview]
Message-ID: <20150507135854.GJ14154@mwanda> (raw)
In-Reply-To: <1430947708-10521-2-git-send-email-German.Rivera@freescale.com>
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
next prev parent reply other threads:[~2015-05-07 13:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-06 21:28 [PATCH v2 0/7] staging: fsl-mc: New functionality to the MC bus driver J. German Rivera
2015-05-06 21:28 ` [PATCH v2 1/7] staging: fsl-mc: MC bus IRQ support J. German Rivera
2015-05-07 13:03 ` Dan Carpenter
2015-05-07 14:51 ` German Rivera
2015-05-07 20:01 ` Dan Carpenter
2015-05-10 13:14 ` Greg KH
2015-05-07 13:58 ` Dan Carpenter [this message]
2015-05-06 21:28 ` [PATCH v2 2/7] staging: fsl_-mc: add device binding path 'driver_override' J. German Rivera
2015-05-10 13:16 ` Greg KH
2015-05-06 21:28 ` [PATCH v2 3/7] staging: fsl-mc: Propagate driver_override for a child DPRC's children J. German Rivera
2015-05-06 21:28 ` [PATCH v2 4/7] staging: fsl-mc: Upgraded MC bus driver to match MC fw 7.0.0 J. German Rivera
2015-05-08 7:22 ` Dan Carpenter
2015-05-06 21:28 ` [PATCH v2 5/7] staging: fsl-mc: Allow the MC bus driver to run without GIC support J. German Rivera
2015-05-06 21:28 ` [PATCH v2 6/7] staging: fsl-mc: Add locking to serialize mc_send_command() calls J. German Rivera
2015-05-06 21:28 ` [PATCH v2 7/7] staging: fsl-mc: Use DPMCP IRQ and completion var to wait for MC J. German Rivera
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=20150507135854.GJ14154@mwanda \
--to=dan.carpenter@oracle.com \
--cc=German.Rivera@freescale.com \
--cc=R89243@freescale.com \
--cc=agraf@suse.de \
--cc=arnd@arndb.de \
--cc=bhamciu1@freescale.com \
--cc=bhupesh.sharma@freescale.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=itai.katz@freescale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nir.erez@freescale.com \
--cc=richard.schmitt@freescale.com \
--cc=scottwood@freescale.com \
--cc=stuart.yoder@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox