From patchwork Fri Nov 21 19:26:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 413168 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 13D79140192 for ; Sat, 22 Nov 2014 06:27:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751045AbaKUT0q (ORCPT ); Fri, 21 Nov 2014 14:26:46 -0500 Received: from mout.web.de ([212.227.17.11]:51991 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750755AbaKUT0p (ORCPT ); Fri, 21 Nov 2014 14:26:45 -0500 Received: from [192.168.1.2] ([78.49.23.187]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MT8bi-1XPxdH3uVS-00S7Se; Fri, 21 Nov 2014 20:26:42 +0100 Message-ID: <546F91E5.60104@users.sourceforge.net> Date: Fri, 21 Nov 2014 20:26:29 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "David S. Miller" , linux-ide@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/1] IDE: Deletion of 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> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:7t9oqhvJswdQLPxeT59OD58g2+Cw4KMyV7s8PfhP8QMJ8cB7o7R H+BEz2IHyMgNsYsyVcxU6Er1xMe5L57aB6VePz6OzDrqR17L0g8hlAYTSggWkzsf00XleUu t4MyzTW3eDfNp2NAIuHcXKg0kClOPAVGzBVVNsMR0t2LYQX64RXlju9YhWU8PxKMrprmFiq VDsTxmiuv5PHpjZNOAMQA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Markus Elfring Date: Fri, 21 Nov 2014 20:22:32 +0100 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 --- drivers/ide/ide.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 2ce6268..e29b02c 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -101,8 +101,7 @@ void ide_device_put(ide_drive_t *drive) struct device *host_dev = drive->hwif->host->dev[0]; struct module *module = host_dev ? host_dev->driver->owner : NULL; - if (module) - module_put(module); + module_put(module); #endif put_device(&drive->gendev); }