From: chenfeng <puck.chen@hisilicon.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <dan.zhao@hisilicon.com>, <w.f@huawei.com>, <linuxarm@huawei.com>,
<paul.gortmaker@windriver.com>, <sumit.semwal@linaro.org>,
<devel@driverdev.osuosl.org>, <xuyiping@hisilicon.com>,
<tapaswenipathak@gmail.com>, <tranmanphong@gmail.com>,
<z.liuxinliang@hisilicon.com>, <kong.kongxinwei@hisilicon.com>,
<qijiwen@hisilicon.com>, <weidong2@hisilicon.com>,
<suzhuangluan@hisilicon.com>, <riandrews@android.com>,
<gioh.kim@lge.com>, <gregkh@linuxfoundation.org>,
<peter.panshilin@hisilicon.com>, <linux-kernel@vger.kernel.org>,
<arve@android.com>, <saberlily.xia@hisilicon.com>
Subject: Re: [PATCH 2/3] staging: android: ion: Add ion driver for Hi6220 SoC platform
Date: Sat, 10 Oct 2015 14:07:33 +0800 [thread overview]
Message-ID: <5618AB25.908@hisilicon.com> (raw)
In-Reply-To: <20151009085848.GT7340@mwanda>
On 2015/10/9 16:58, Dan Carpenter wrote:
> On Fri, Oct 09, 2015 at 11:53:32AM +0300, Dan Carpenter wrote:
>>> +out:
>>
>> Labels named "out" are bug prone because handling everything is harder
>> than using named labels and unwinding one step at a time. The bug here
>> is that we don't call ion_device_destroy().
>>
>>> + for (i = 0; i < num_heaps; ++i)
>>> + ion_heap_destroy(heaps[i]);
>>> + return err;
>>
>> Write it like this:
>>
>> err_free_heaps:
>> for (i = 0; i < num_heaps; ++i)
>> ion_heap_destroy(heaps[i]);
>> err_free_idev:
>> ion_device_destroy(idev);
>>
>> return err;
>>
>>> +}
>>> +
>>> +static int hi6220_ion_remove(struct platform_device *pdev)
>>> +{
>>> + int i;
>>> +
>>> + ion_device_destroy(idev);
>>> + for (i = 0; i < num_heaps; i++) {
>>> + if (!heaps[i])
>>> + continue;
>>
>> We don't really need this NULL check and it isn't there in the
>> hi6220_ion_probe() unwind code.
>>
>>> + ion_heap_destroy(heaps[i]);
>>> + heaps[i] = NULL;
>>> + }
>>> +
>
> Really the unwind from probe() and the remove() function should have
> similar code. For example, is it important to set heaps[i] to NULL?
> If so then we should do it in the probe function as well. If not then
> we could leave it out of the remove function.
>
> Also the ion_device_destroy(idev) should be after freeing heaps in the
> remove function.
>
Thanks.
I will modify this next version.
> regards,
> dan carpenter
>
>
> .
>
next prev parent reply other threads:[~2015-10-10 6:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 7:55 [PATCH 1/3] docs: dts: Add documentation for hi6220 SoC ION node Chen Feng
2015-10-08 7:55 ` [PATCH 2/3] staging: android: ion: Add ion driver for Hi6220 SoC platform Chen Feng
2015-10-08 8:52 ` Greg KH
2015-10-08 12:03 ` kbuild test robot
2015-10-09 8:53 ` Dan Carpenter
2015-10-09 8:58 ` Dan Carpenter
2015-10-10 6:07 ` chenfeng [this message]
2015-10-09 9:08 ` xuyiping
2015-10-08 7:55 ` [PATCH 3/3] arm64: dts: Add dts files to enable ION on Hi6220 SoC Chen Feng
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=5618AB25.908@hisilicon.com \
--to=puck.chen@hisilicon.com \
--cc=arve@android.com \
--cc=dan.carpenter@oracle.com \
--cc=dan.zhao@hisilicon.com \
--cc=devel@driverdev.osuosl.org \
--cc=gioh.kim@lge.com \
--cc=gregkh@linuxfoundation.org \
--cc=kong.kongxinwei@hisilicon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=paul.gortmaker@windriver.com \
--cc=peter.panshilin@hisilicon.com \
--cc=qijiwen@hisilicon.com \
--cc=riandrews@android.com \
--cc=saberlily.xia@hisilicon.com \
--cc=sumit.semwal@linaro.org \
--cc=suzhuangluan@hisilicon.com \
--cc=tapaswenipathak@gmail.com \
--cc=tranmanphong@gmail.com \
--cc=w.f@huawei.com \
--cc=weidong2@hisilicon.com \
--cc=xuyiping@hisilicon.com \
--cc=z.liuxinliang@hisilicon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.