Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755252AbbGEKB2 (ORCPT ); Sun, 5 Jul 2015 06:01:28 -0400 Received: from mout.web.de ([212.227.17.11]:59456 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbbGEKB0 (ORCPT ); Sun, 5 Jul 2015 06:01:26 -0400 Message-ID: <559794F9.3050800@users.sourceforge.net> Date: Sat, 04 Jul 2015 10:10:33 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S. Miller" , Masami Hiramatsu CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] kprobes: Delete an unnecessary check before the function call "module_put" References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <546899CF.8020808@users.sourceforge.net> <5469B08E.90104@hitachi.com> <546C41EF.4040502@users.sourceforge.net> <546D65C6.3030109@hitachi.com> In-Reply-To: <546D65C6.3030109@hitachi.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:jKsakWNj/RJNQxUcObgyQnB2y69EH3vcnSsDld8BM09sPjzKPed Z3ExylkhDcavCWUsIFgDNnA0SN0MGfeocjlHkHx9skLX8vr5JkzGA+QaCzRuSnZ5GztMSIL THQxEjAkc5LXYHFlFv7EbVhEHDCtpw6fKVq7wnrSi7tJGjYoEsKDT3lpsNu6nEsKWL77jUj aRkbrLxXKhMRzRJp3UR2g== X-UI-Out-Filterresults: notjunk:1;V01:K0:QGv0w5/WBac=:PZPBp62YHR8gth6tOnuR+y 25wZHhcWL4KnWKEfdPzBDQA9VUxyclCtEYE6bH4+ejSrw6dMsqOql+EpPtrb7U3TToiTvENHU xKBJzWtcx6sdHWY0wzz/HgVo8Mdeqa3oN2ouD5NfnjKIuGJDuIqZtelf427FI37L0zUsVuncZ bdGyuJeG9ZFkdnGnJ5UhdoRxlWbJtqelDU5k8a72Ug+9FBpITWA5Qn8iYaoZ/RAP/D8SnhlN4 01v0GZVEWtuc+Ub+z5ntw4p8PYSndlMvqXo5ZTF7y3uXre8MgdPfI4kcF4YdLsBPGoULLWdZW 4oXTQqfUjV/rHK69HCXQ0M+tJXztScPvQbE7DuzEXxlwLy4dTJtqMyrw8pTDj4OYgIW+spo7J BQRRt18Ym7CHryTYxrzgu7t3csDukJZBrlnfEYaxa2p4m6UsVTf02DeA4RobWyKst4UGqg+xS 7XeB/chmiaPXzDfI+DulP6k1MzXt7qhZEwsVzMeULAmj/6emoAQ0gdACe9er0vJIZLcVURuw9 AX7Q3Ps+sBLykXr1anNd7ocsVtRHWXlm55+z7sWphvGZLNn5+mTd0lh7fOYgk9DOAFbC1nf5L GG2aK73DFF9IxLq4sUOZeV0OmlqUws0AAbEldkttpYs8TsvfqALDI2HvOniePvgfWenBvOxZ/ 8Eus54Aom0exZqGNQChLhZGIHbIr3bmZ63SoWg8Z1eFFcmZ/f15RSBen9RghEJLEuZnQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1040 Lines: 37 From: Markus Elfring Date: Sat, 4 Jul 2015 10:00:26 +0200 The module_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- kernel/kprobes.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c90e417..52e3529 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1531,10 +1531,7 @@ int register_kprobe(struct kprobe *p) out: mutex_unlock(&kprobe_mutex); - - if (probed_mod) - module_put(probed_mod); - + module_put(probed_mod); return ret; } EXPORT_SYMBOL_GPL(register_kprobe); -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/