From mboxrd@z Thu Jan 1 00:00:00 1970 From: zhong jiang Subject: Re: [PATCH] wireless: remove unnecessary condition check before kfree Date: Mon, 10 Sep 2018 21:54:36 +0800 Message-ID: <5B96779C.5060306@huawei.com> References: <1536415955-33776-1-git-send-email-zhongjiang@huawei.com> <1536563406.3224.2.camel@sipsolutions.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: , , , To: Johannes Berg Return-path: In-Reply-To: <1536563406.3224.2.camel@sipsolutions.net> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 2018/9/10 15:10, Johannes Berg wrote: > On Sat, 2018-09-08 at 22:12 +0800, zhong jiang wrote: >> kfree has taken the null pointer into account. Just remove the >> redundant condition check before kfree. > I'm all for doing that if it actually removes conditionals, but > >> - if (!IS_ERR_OR_NULL(regdb)) >> + if (!IS_ERR(regdb)) >> kfree(regdb); > this seems rather pointless since there's still a condition. In that > case, I feel it's easier to understand the original code. Fine, make sense you have said. I just consider the duplication of function. Thanks, zhong jiang > johannes > > . >