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


Groups > linux.kernel > #1263211 > unrolled thread

[PATCH] staging: most: Delete an unnecessary check before the function call "module_put"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-11-05 14:50 +0100
Last post2015-11-05 15:10 +0100
Articles 3 — 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] staging: most: Delete an unnecessary check before the  function call "module_put" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-05 14:50 +0100
    Re: [PATCH] staging: most: Delete an unnecessary check before the  function call "module_put" Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-05 15:00 +0100
      Re: staging: most: Delete an unnecessary check before the function  call "module_put" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-05 15:10 +0100

#1263211 — [PATCH] staging: most: Delete an unnecessary check before the function call "module_put"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-05 14:50 +0100
Subject[PATCH] staging: most: Delete an unnecessary check before the function call "module_put"
Message-ID<qrt5n-7ln-13@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Nov 2015 14:34:43 +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 <elfring@users.sourceforge.net>
---
 drivers/staging/most/mostcore/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index 19852ca..ed1ed25 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1587,8 +1587,7 @@ out:
 	return 0;
 
 error:
-	if (iface->mod)
-		module_put(iface->mod);
+	module_put(iface->mod);
 	modref--;
 	mutex_unlock(&c->start_mutex);
 	return ret;
-- 
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]


#1263228

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-11-05 15:00 +0100
Message-ID<qrtf5-7pc-35@gated-at.bofh.it>
In reply to#1263211
Relying on hidden sanity checks makes the code harder to read.  A human
being cannot remember which functions have sanity checks and which do
not.  These sorts of patches are easy to generate automatically but they
make the code worse.  There are so many *better* things to do instead of
focusing on making the code bad.

Please stop sending these patches for drivers/staging.  You are welcome
to send them for other subsystems which I don't care about.

regards,
dan carpenter

--
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] | [next] | [standalone]


#1263231 — Re: staging: most: Delete an unnecessary check before the function call "module_put"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-05 15:10 +0100
SubjectRe: staging: most: Delete an unnecessary check before the function call "module_put"
Message-ID<qrtoK-7I5-13@gated-at.bofh.it>
In reply to#1263228
> Please stop sending these patches for drivers/staging.

Will further contributors take another look at similar update suggestions?


> You are welcome to send them for other subsystems

Thanks for this suggestion.


> which I don't care about.

I am curious if other software developers will give more positive feedback
on the proposed source code fine-tuning because of collateral evolution.

Regards,
Markus
--
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