From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Peter Griffin <peter.griffin@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com,
maxime.coquelin@st.com, patrice.chotard@st.com,
vinod.koul@intel.com, ohad@wizery.com, arnd@arndb.de,
lee.jones@linaro.org, devicetree@vger.kernel.org,
dmaengine@vger.kernel.org, linux-remoteproc@vger.kernel.org,
Ludovic Barre <ludovic.barre@st.com>
Subject: Re: [PATCH v4 06/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support
Date: Wed, 25 May 2016 10:27:23 -0700 [thread overview]
Message-ID: <20160525172723.GU1256@tuxbot> (raw)
In-Reply-To: <1464192412-16386-8-git-send-email-peter.griffin@linaro.org>
On Wed 25 May 09:06 PDT 2016, Peter Griffin wrote:
> diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c
[..]
> +
> +static int st_fdma_alloc_chan_res(struct dma_chan *chan)
> +{
> + struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
> + int ret;
> +
> + /* Create the dma pool for descriptor allocation */
> + fchan->node_pool = dma_pool_create(dev_name(&chan->dev->device),
> + fchan->fdev->dev,
> + sizeof(struct st_fdma_hw_node),
> + __alignof__(struct st_fdma_hw_node),
> + 0);
> +
> + if (!fchan->node_pool) {
> + dev_err(fchan->fdev->dev, "unable to allocate desc pool\n");
> + return -ENOMEM;
> + }
> +
> +
> + ret = rproc_boot(fchan->fdev->rproc);
> + if (ret) {
> + dev_err(fchan->fdev->dev, "rproc_boot failed\n");
rproc_boot(), rproc_fw_boot() and xp70_rproc_start() has already given
you specific error messages; drop this generic message.
Don't you want to destroy the dma_pool if this happens?
> + return ret;
> + }
> +
> + dev_dbg(fchan->fdev->dev, "alloc ch_id:%d type:%d\n",
> + fchan->vchan.chan.chan_id, fchan->cfg.type);
> +
> + return 0;
> +}
> +
[..]
> +
> +static const struct st_fdma_driverdata fdma_mpe31_stih407_11 = {
> + .name = "STiH407",
> + .id = 0,
> +};
> +
> +static const struct st_fdma_driverdata fdma_mpe31_stih407_12 = {
> + .name = "STiH407",
> + .id = 1,
> +};
> +
> +static const struct st_fdma_driverdata fdma_mpe31_stih407_13 = {
> + .name = "STiH407",
> + .id = 2,
> +};
> +
> +static const struct of_device_id st_fdma_match[] = {
> + { .compatible = "st,stih407-fdma-mpe31-11"
> + , .data = &fdma_mpe31_stih407_11 },
> + { .compatible = "st,stih407-fdma-mpe31-12"
> + , .data = &fdma_mpe31_stih407_12 },
> + { .compatible = "st,stih407-fdma-mpe31-13"
> + , .data = &fdma_mpe31_stih407_13 },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, st_fdma_match);
> +
> +static int st_fdma_parse_dt(struct platform_device *pdev,
> + const struct st_fdma_driverdata *drvdata,
> + struct st_fdma_dev *fdev)
> +{
> + struct device_node *np = pdev->dev.of_node;
> + int ret;
> +
> + if (!np)
> + goto err;
ret is left uninitialized here. Also as no error handling is done, just
return your error directly.
> +
> + ret = of_property_read_u32(np, "dma-channels", &fdev->nr_channels);
> + if (ret)
> + goto err;
> +
> + snprintf(fdev->fw_name, FW_NAME_SIZE, "fdma_%s_%d.elf",
> + drvdata->name, drvdata->id);
> +
> +err:
> + return ret;
> +}
> +#define FDMA_DMA_BUSWIDTHS (BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
> + BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
> + BIT(DMA_SLAVE_BUSWIDTH_3_BYTES) | \
> + BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))
> +
> +static int st_fdma_probe(struct platform_device *pdev)
> +{
> + struct st_fdma_dev *fdev;
> + const struct of_device_id *match;
> + struct device_node *np = pdev->dev.of_node;
> + const struct st_fdma_driverdata *drvdata;
> + int ret, i;
> +
> + match = of_match_device((st_fdma_match), &pdev->dev);
> + if (!match || !match->data) {
> + dev_err(&pdev->dev, "No device match found\n");
> + return -ENODEV;
> + }
> +
> + drvdata = match->data;
Use of_device_get_match_data() instead. This also allows you to keep the
of_match_table and driverdata at the end of the file.
[..]
> +
> + fdev->rproc = xp70_rproc_alloc(pdev, fdev->fw_name);
> + if (!fdev->rproc) {
> + dev_err(&pdev->dev, "xp70_rproc_init failed\n");
All (non-development) error paths in xp70_rproc_alloc() will have
already printed a more specific error message, so no need to print
another generic on here.
> + ret = PTR_ERR(fdev->rproc);
> + goto err;
> + }
> +
Regards,
Bjorn
next prev parent reply other threads:[~2016-05-25 17:27 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 16:06 [PATCH 00/18] Add support for FDMA DMA controller and xp70 rproc found on STi chipsets Peter Griffin
2016-05-25 16:06 ` [PATCH v4 " Peter Griffin
2016-05-25 16:06 ` [PATCH v4 01/18] remoteproc: st_xp70_rproc: add a xp70 slimcore rproc driver Peter Griffin
2016-05-25 17:10 ` Bjorn Andersson
2016-06-06 7:22 ` Peter Griffin
2016-05-27 13:15 ` Patrice Chotard
[not found] ` <57484867.6030608-qxv4g6HH51o@public.gmane.org>
2016-05-27 16:13 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 02/18] ARM: multi_v7_defconfig: enable st xp70 " Peter Griffin
2016-05-25 16:06 ` [PATCH v4 03/18] MAINTAINERS: Add st xp70 rproc driver to STi section Peter Griffin
2016-05-25 16:06 ` [PATCH v4 04/18] dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding documentation Peter Griffin
[not found] ` <1464192412-16386-6-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-05-27 15:44 ` Rob Herring
2016-05-25 16:06 ` [PATCH v4 05/18] dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file Peter Griffin
2016-06-06 4:36 ` Vinod Koul
2016-06-06 17:40 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 06/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support Peter Griffin
2016-05-25 17:27 ` Bjorn Andersson [this message]
[not found] ` <1464192412-16386-8-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-06 4:54 ` Vinod Koul
2016-06-06 17:38 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 07/18] ARM: STi: DT: STiH407: Add FDMA driver dt nodes Peter Griffin
2016-05-25 16:06 ` [PATCH v4 08/18] MAINTAINERS: Add FDMA driver files to STi section Peter Griffin
2016-05-25 16:06 ` [PATCH v4 09/18] ARM: multi_v7_defconfig: Enable STi FDMA driver Peter Griffin
2016-05-25 16:06 ` [PATCH v4 10/18] ASoC: sti: Update DT example to match the driver code Peter Griffin
[not found] ` <1464192412-16386-12-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-05-27 15:47 ` Rob Herring
2016-05-27 17:14 ` Mark Brown
2016-06-03 13:05 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 11/18] ARM: multi_v7_defconfig: Enable STi and simple-card drivers Peter Griffin
2016-05-31 8:55 ` Arnaud Pouliquen
[not found] ` <574D5178.5030200-qxv4g6HH51o@public.gmane.org>
2016-06-03 12:39 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 12/18] ARM: DT: STiH407: Add i2s_out pinctrl configuration Peter Griffin
2016-05-25 16:06 ` [PATCH v4 13/18] ARM: DT: STiH407: Add i2s_in " Peter Griffin
2016-05-25 16:06 ` [PATCH v4 14/18] ARM: DT: STiH407: Add spdif_out pinctrl config Peter Griffin
2016-05-25 16:06 ` [PATCH v4 15/18] ARM: STi: DT: STiH407: Add sti-sasg-codec dt node Peter Griffin
2016-05-31 9:05 ` Arnaud Pouliquen
2016-06-03 13:00 ` Peter Griffin
[not found] ` <1464192412-16386-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-05-25 16:06 ` [PATCH v4 16/18] ARM: STi: DT: STiH407: Add uniperif player dt nodes Peter Griffin
[not found] ` <1464192412-16386-18-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-05-31 9:14 ` Arnaud Pouliquen
2016-06-03 12:56 ` Peter Griffin
2016-06-06 5:01 ` [PATCH 00/18] Add support for FDMA DMA controller and xp70 rproc found on STi chipsets Vinod Koul
2016-06-06 15:09 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 17/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes Peter Griffin
2016-05-31 9:18 ` Arnaud Pouliquen
[not found] ` <574D56CE.5020802-qxv4g6HH51o@public.gmane.org>
2016-06-03 12:50 ` Peter Griffin
2016-05-25 16:06 ` [PATCH v4 18/18] ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card Peter Griffin
2016-05-31 10:16 ` Arnaud Pouliquen
2016-06-03 12:47 ` Peter Griffin
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=20160525172723.GU1256@tuxbot \
--to=bjorn.andersson@linaro.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ludovic.barre@st.com \
--cc=maxime.coquelin@st.com \
--cc=ohad@wizery.com \
--cc=patrice.chotard@st.com \
--cc=peter.griffin@linaro.org \
--cc=srinivas.kandagatla@gmail.com \
--cc=vinod.koul@intel.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;
as well as URLs for NNTP newsgroup(s).