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


Groups > linux.kernel > #1269509 > unrolled thread

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

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-11-14 18:20 +0100
Last post2015-11-16 21:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [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

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

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-14 18:20 +0100
Subject[PATCH] net: dsa: Delete an unnecessary check before the function call "put_device"
Message-ID<quMEy-6RF-19@gated-at.bofh.it>
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/

[toc] | [next] | [standalone]


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

FromDavid Miller <davem@davemloft.net>
Date2015-11-16 21:20 +0100
SubjectRe: [PATCH] net: dsa: Delete an unnecessary check before the function call "put_device"
Message-ID<qvypQ-3xw-7@gated-at.bofh.it>
In reply to#1269509
I'm starting to grow quite weary of these "unnecessary check" changes.

Sometimes it is better to have them, either because the path is a hot
path or some atomic sequence is involved.

But there is never harm in them being there.

All of this is a matter of taste, of course.  But one thing I know for
sure, it is undisputable that there are much more important things to
work on than this kind of stuff...

So I'm not applying these changes any more and directing my time and
effort to reviewing and applying patches that fix bugs, really
restructure the code in useful ways that increase maintainability over
the long time, and add interesting new features.

These patches do none of the above.
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web