From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Berg Subject: Re: [PATCH] wireless: remove unnecessary condition check before kfree Date: Mon, 10 Sep 2018 09:10:06 +0200 Message-ID: <1536563406.3224.2.camel@sipsolutions.net> References: <1536415955-33776-1-git-send-email-zhongjiang@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: zhong jiang , davem@davemloft.net Return-path: In-Reply-To: <1536415955-33776-1-git-send-email-zhongjiang@huawei.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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. johannes