From: zhong jiang <zhongjiang@huawei.com>
To: Christophe LEROY <christophe.leroy@c-s.fr>
Cc: <paulus@samba.org>, <benh@kernel.crashing.org>,
<mpe@ellerman.id.au>, <linuxppc-dev@lists.ozlabs.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] powerpc: Move a dereference below a NULL test
Date: Wed, 26 Sep 2018 22:06:21 +0800 [thread overview]
Message-ID: <5BAB925D.1030803@huawei.com> (raw)
In-Reply-To: <fb8bc993-2adc-6a70-2643-6195ba5f020f@c-s.fr>
On 2018/9/26 21:58, Christophe LEROY wrote:
>
>
> Le 26/09/2018 à 13:46, zhong jiang a écrit :
>> It is safe to move dereference below a NULL test.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>> arch/powerpc/kernel/cacheinfo.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
>> index a8f20e5..7f19714 100644
>> --- a/arch/powerpc/kernel/cacheinfo.c
>> +++ b/arch/powerpc/kernel/cacheinfo.c
>> @@ -401,14 +401,13 @@ static struct cache *cache_lookup_or_instantiate(struct device_node *node,
>> struct cache *cache;
>> cache = cache_lookup_by_node(node);
>> + if (!cache)
>> + cache = cache_do_one_devnode(node, level);
>
> But by doing this, you change the meaning of the following warning. Is that what you want ? In that case the text of the WARN_ONCE() should be changed, because the mismatch is not only on lookup now.
>
Yep, I forget the WARN_ONCE. I think we should just remove it. Thought?
Thanks,
zhong jiang
> Christophe
>
>> WARN_ONCE(cache && cache->level != level,
>> "cache level mismatch on lookup (got %d, expected %d)\n",
>> cache->level, level);
>> - if (!cache)
>> - cache = cache_do_one_devnode(node, level);
>> -
>> return cache;
>> }
>>
>
> .
>
next prev parent reply other threads:[~2018-09-26 14:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-26 11:46 [PATCH] powerpc: Move a dereference below a NULL test zhong jiang
2018-09-26 13:58 ` Christophe LEROY
2018-09-26 14:06 ` zhong jiang [this message]
2018-09-26 14:22 ` Michal Suchánek
2018-09-26 14:42 ` zhong jiang
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=5BAB925D.1030803@huawei.com \
--to=zhongjiang@huawei.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/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.