mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Xiyu Yang <xiyuyang19@fudan.edu.cn>,
	Xin Tan <tanxin.ctf@gmail.com>,
	linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	"Andreas Färber" <afaerber@suse.de>, "Kangjie Lu" <kjlu@umn.edu>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Yuan Zhang" <yuanxzhang@fudan.edu.cn>
Subject: Re: [PATCH] mmc: owl-mmc: Fix dma_chan refcnt leak in owl_mmc_probe()
Date: Sat, 25 Apr 2020 21:30:22 +0200	[thread overview]
Message-ID: <282da79a-eda7-f534-a6ed-8ac38fcc2c8b@web.de> (raw)

> Fix this issue by jumping to "err_put_dma" label when those error
> scenarios occur.

I suggest to reconsider your jump target selection.


…
> +++ b/drivers/mmc/host/owl-mmc.c
…
> @@ -643,19 +643,22 @@ static int owl_mmc_probe(struct platform_device *pdev)
>  	return 0;
>
> +err_put_dma:
> +	if (owl_host->dma)
> +		dma_release_channel(owl_host->dma);

I interpret the source code in the way that you would like to call
this function for the desired exception handling only after a call
of the function “dma_request_chan” succeeded.
Thus I would expect that the passed pointer will usually be still valid.
(Can the proposed null pointer check be omitted then?)

How do you think about the following change possibility?

+err_release_channel:
+	dma_release_channel(owl_host->dma);


Would you like to add the tag “Fixes” to the change description?

Regards,
Markus

             reply	other threads:[~2020-04-25 19:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 19:30 Markus Elfring [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-04-25 12:53 Xiyu Yang

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=282da79a-eda7-f534-a6ed-8ac38fcc2c8b@web.de \
    --to=markus.elfring@web.de \
    --cc=afaerber@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=tanxin.ctf@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=xiyuyang19@fudan.edu.cn \
    --cc=yuanxzhang@fudan.edu.cn \
    /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

all inboxes | Powered by JetHome®