From patchwork Wed Jun 24 14:16:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 6668221 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A771C05AC for ; Wed, 24 Jun 2015 14:16:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8604A206D9 for ; Wed, 24 Jun 2015 14:16:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F86620666 for ; Wed, 24 Jun 2015 14:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753419AbbFXOQk (ORCPT ); Wed, 24 Jun 2015 10:16:40 -0400 Received: from mout.web.de ([212.227.17.12]:57565 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796AbbFXOQi (ORCPT ); Wed, 24 Jun 2015 10:16:38 -0400 Received: from [192.168.1.3] ([78.49.141.189]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0Lw0uH-1Z2Pio3gh3-017pJO; Wed, 24 Jun 2015 16:16:36 +0200 Message-ID: <558ABBC2.8080304@users.sourceforge.net> Date: Wed, 24 Jun 2015 16:16:34 +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: Benny Halevy , Boaz Harrosh , "James E. J. Bottomley" , linux-scsi@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] SCSI-OSD: Delete an unnecessary check before the function call "put_disk" 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> <546E238A.5050606@users.sourceforge.net> In-Reply-To: <546E238A.5050606@users.sourceforge.net> X-Provags-ID: V03:K0:C/npAT7AXQzBBjVyksll0M4+RZV3XLfv0OO/Qsq7VK0y+rqkXsE tbz7X/TmtMVBZt9ZBasKNptUAlPUtmlvSxFIB6ABMm88w7VeXeoAWouBAvwtZKO1iGL+Sch Mp9LWe+67KuUefuMJ6xj8l2JaviS8fc95s24ncdIaleZL/wpztPlZ0gUGWl0bwg2ggUU9cY 0JB6zSY1Wew9J2DCeyMYQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ylV7Jan6aVU=:wt6QMABoLEqOWSffv6WT7w IPL9oVKFvYu3dvMwgX41hGQwm0kudVy4TnE8iHtmo8ks9/gsZNT7wn0NCp5Pd9NJZ4iMopDry +9kY1jFuD9ZsmdbYZAlsplFZGvpUldOB5a3GG203pNIa9XNJiOq7omrbMLrccrA3iQlK3SGWT HKCNso5gPaxJoZXHdt9YtOgQIHFV1nsx93cU2ukvLdwsFIkDqA2xEwobUVazOwE0XJMaNNr0m ltJj07f+lN76saUblCrUyKZTFuJO5yPRQef9UEbS8kuDTHsCTnoFTClUHZrYZL7Jtp1WkVjBc j1CvaiYZ53h5DEUOG7HEe3eAf5yy2d6AR70TXTDQjb89FvVoiwUNEoOhsK7aZnONVz07RA3RA dBzsAruGQ6z9zMAVNgb3dLRO8j5l/Fiw7Qf6bdj8qWfbg5u2DYG16ILliYM5aiLB3yoZU++xU uKIXhIc9a+sLcxTQtFsED1Ive3lRXH0cw+PJ0qRLcP9cpmjBWagBbkriHS+1zOZPFQ0Z+km9v gbeFSxDjt8bBxqYc5xh7RZPsARvLUwIgBz33R/JUdTFqjttIpzqJcA6eLnCV+s5FyjYZaAlFr HK7N+X0A0Z+Rnc8tkreB2E3Xm6Y1Jva2vw74IR8MNtkIxt1ddR/q1OFgszCokgwQjWzKCZ7mE mOwc1zEQfTCsy9lI+PYUiev5rSYi8rUsNzbMDHOZTccp8MjUiuztm7YjpnikBgf+fc90= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 24 Jun 2015 16:06:21 +0200 The put_disk() 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 Reviewed-by: Johannes Thumshirn --- drivers/scsi/osd/osd_uld.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index 243eab3..e2075522 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c @@ -407,9 +407,7 @@ static void __remove(struct device *dev) OSD_INFO("osd_remove %s\n", oud->disk ? oud->disk->disk_name : NULL); - - if (oud->disk) - put_disk(oud->disk); + put_disk(oud->disk); ida_remove(&osd_minor_ida, oud->minor); kfree(oud);