Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269509

[PATCH] net: dsa: Delete an unnecessary check before the function call "put_device"

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH] net: dsa: Delete an unnecessary check before the function call "put_device"
Date Sat, 14 Nov 2015 18:20:02 +0100
Message-ID <quMEy-6RF-19@gated-at.bofh.it> (permalink)
References <mSsDN-4wa-35@gated-at.bofh.it> <mSsDN-4wa-37@gated-at.bofh.it> <mSsDN-4wa-39@gated-at.bofh.it> <mSsDN-4wa-41@gated-at.bofh.it> <mSsDN-4wa-43@gated-at.bofh.it> <mSsDN-4wa-45@gated-at.bofh.it> <mSsDN-4wa-47@gated-at.bofh.it> <mSsDN-4wa-49@gated-at.bofh.it> <mSsDN-4wa-51@gated-at.bofh.it> <mSsDN-4wa-53@gated-at.bofh.it> <mSsDN-4wa-55@gated-at.bofh.it> <mSsDN-4wa-57@gated-at.bofh.it> <mSsDN-4wa-59@gated-at.bofh.it> <mSsDN-4wa-61@gated-at.bofh.it> <mSsDN-4wa-63@gated-at.bofh.it> <mSsDN-4wa-65@gated-at.bofh.it> <mSsDN-4wa-33@gated-at.bofh.it>
X-Original-To "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
X-Provags-ID V03:K0:XgVJrBrVVKH1kbLeFv6RWvNzcIKlXLwhMofry5OonoWrdxzQH4e oh99Exs8hbjemW7l30f6LMzW/iqUJ2D9BgqiCNW2m0ZNMI3d3GbDe2zs1nRcV/rONg1P1oj 9e8RBoXxMOOHCSZz3zxCmXe1s5QKyUjPf96jOJbfSvOdLHAAbXvxDEb+pxZG0T6qS0oF37a fg7GTLPaY4YLGxTN8zB2w==
X-Ui-Out-Filterresults notjunk:1;V01:K0:IFZy4Aicudk=:lCL2uQSCjj8yf+a3o82VVR WG69lloyHtIQlrs3EXiknkRkc5G3GnGkUC4WaWRfdZIZjzUw/feRgoLe5rG+ty75Cgx+S10Ti UMQ/4+HklJJrgse0yBZE+GXZxB4jmJ1zW8+k/L6CCGLb4OvyD+Su2OsNNQj2d+Id8oqbNw46q UWoStEsRNAwltvdxH/F+Z0OwF1j8B7qdz/ZrqfbFxCqGXemGjKe4n8RClrdmz0OagVPM/Rd3y mVzO+dyo9OgTaA5aUStJoOoViS7Jze0QNZtpBky39Bu0iW0dKaTEJSULi4tKO0iIHKUmb1Pae +GZKIjoDimazppPio4oLz4XjOGwjeEfpfF7fJxgQUAncLrFyxHZOZSdbP84CYNEvLmbj956bR OHFhO6naazLZhp2CVcmkXKJNaPGXK/+oYu8CZsGRhqcjlhjXw6utID7OZt0II9YntcTp7I/UH FVVQtchznpX1qT5On+cVVTTKO5rOh52Pf37U53vIty7FPQ/fEPDTU7WXwtGQKCH6+B2E2OvoN BxoBE8ml22VyDoP4KV7qp8Eo2b1SfeEe8l6SaOF+RjNJ974Msa9NNAn9ZdzRNf3Zan0IJfMWT DAhi/24g1FOvfIEKeHsqe+WuHL0wIO9KytSiA1GUmsU5XnrqORR8gzHynxIJxCvF0Y+Gk6OGd IipT88tMdEPNk8m/YkhfW9YmEbR9ZxTDpk7W+2IM0siV5ZetiBwH235/6ppjwIbcWj35OlbjX ePn96mgq6Bb8qN/NTV2Bntoi2e/WuFbLO+NGSTuFoPS/AhgEMASdLVOWIWCPHWXRai2CVJ4b2 tY5i4yN
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 35
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>
X-Original-Date Sat, 14 Nov 2015 18:12:44 +0100
X-Original-Message-ID <56476B8C.7020309@users.sourceforge.net>
X-Original-References <5307CAA2.8060406@users.sourceforge.net> <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6> <530A086E.8010901@users.sourceforge.net> <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6> <530A72AA.3000601@users.sourceforge.net> <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6> <530B5FB6.6010207@users.sourceforge.net> <alpine.DEB.2.10.1402241710370.2074@hadrien> <530C5E18.1020800@users.sourceforge.net> <alpine.DEB.2.10.1402251014170.2080@hadrien> <530CD2C4.4050903@users.sourceforge.net> <alpine.DEB.2.10.1402251840450.7035@hadrien> <530CF8FF.8080600@users.sourceforge.net> <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6> <530DD06F.4090703@users.sourceforge.net> <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6> <5317A59D.4@users.sourceforge.net>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1269509

Show key headers only | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 14 Nov 2015 17:58:00 +0100

The put_device() 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 <elfring@users.sourceforge.net>
---
 net/dsa/dsa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 1eba07f..045d776 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -671,8 +671,7 @@ static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
 		kfree(pd->chip[i].rtable);
 
 		/* Drop our reference to the MDIO bus device */
-		if (pd->chip[i].host_dev)
-			put_device(pd->chip[i].host_dev);
+		put_device(pd->chip[i].host_dev);
 	}
 	kfree(pd->chip);
 }
-- 
2.6.2

--
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/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: dsa: Delete an unnecessary check before the function  call "put_device" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-14 18:20 +0100
  Re: [PATCH] net: dsa: Delete an unnecessary check before the  function call "put_device" David Miller <davem@davemloft.net> - 2015-11-16 21:20 +0100

csiph-web