* [PATCH 1/1] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put"
[not found] ` <5317A59D.4@users.sourceforge.net>
@ 2014-11-17 18:19 ` SF Markus Elfring
2014-11-17 19:18 ` Vyacheslav Dubeyko
2014-11-18 8:35 ` [PATCH 1/1] fs-eventpoll: Deletion of unnecessary checks before the function call "__pm_stay_awake" SF Markus Elfring
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2014-11-17 18:19 UTC (permalink / raw)
To: linux-fsdevel; +Cc: LKML, kernel-janitors, Coccinelle
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 17 Nov 2014 19:13:56 +0100
The hfs_bnode_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>
---
fs/hfs/bfind.c | 3 +--
fs/hfs/brec.c | 3 +--
fs/hfsplus/bfind.c | 3 +--
fs/hfsplus/brec.c | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index de69d8a..0e26523 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -100,8 +100,7 @@ int hfs_brec_find(struct hfs_find_data *fd)
int height, res;
tree = fd->tree;
- if (fd->bnode)
- hfs_bnode_put(fd->bnode);
+ hfs_bnode_put(fd->bnode);
fd->bnode = NULL;
nidx = tree->root;
if (!nidx)
diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
index 9f4ee7f..3a52b2c 100644
--- a/fs/hfs/brec.c
+++ b/fs/hfs/brec.c
@@ -272,8 +272,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
/* panic? */
hfs_bnode_put(node);
hfs_bnode_put(new_node);
- if (next_node)
- hfs_bnode_put(next_node);
+ hfs_bnode_put(next_node);
return ERR_PTR(-ENOSPC);
}
diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c
index c1422d9..7be88e3 100644
--- a/fs/hfsplus/bfind.c
+++ b/fs/hfsplus/bfind.c
@@ -171,8 +171,7 @@ int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare)
int height, res;
tree = fd->tree;
- if (fd->bnode)
- hfs_bnode_put(fd->bnode);
+ hfs_bnode_put(fd->bnode);
fd->bnode = NULL;
nidx = tree->root;
if (!nidx)
diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
index 6e560d5..59bab47 100644
--- a/fs/hfsplus/brec.c
+++ b/fs/hfsplus/brec.c
@@ -276,8 +276,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
/* panic? */
hfs_bnode_put(node);
hfs_bnode_put(new_node);
- if (next_node)
- hfs_bnode_put(next_node);
+ hfs_bnode_put(next_node);
return ERR_PTR(-ENOSPC);
}
--
2.1.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put"
2014-11-17 18:19 ` [PATCH 1/1] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put" SF Markus Elfring
@ 2014-11-17 19:18 ` Vyacheslav Dubeyko
2015-06-29 13:40 ` [PATCH] " SF Markus Elfring
0 siblings, 1 reply; 8+ messages in thread
From: Vyacheslav Dubeyko @ 2014-11-17 19:18 UTC (permalink / raw)
To: SF Markus Elfring; +Cc: linux-fsdevel, LKML, kernel-janitors, Coccinelle
On Mon, 2014-11-17 at 19:19 +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 17 Nov 2014 19:13:56 +0100
>
> The hfs_bnode_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.
>
Thank you. It's the reasonable correction. Looks good for me.
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Thanks,
Vyacheslav Dubeyko.
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> fs/hfs/bfind.c | 3 +--
> fs/hfs/brec.c | 3 +--
> fs/hfsplus/bfind.c | 3 +--
> fs/hfsplus/brec.c | 3 +--
> 4 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
> index de69d8a..0e26523 100644
> --- a/fs/hfs/bfind.c
> +++ b/fs/hfs/bfind.c
> @@ -100,8 +100,7 @@ int hfs_brec_find(struct hfs_find_data *fd)
> int height, res;
>
> tree = fd->tree;
> - if (fd->bnode)
> - hfs_bnode_put(fd->bnode);
> + hfs_bnode_put(fd->bnode);
> fd->bnode = NULL;
> nidx = tree->root;
> if (!nidx)
> diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
> index 9f4ee7f..3a52b2c 100644
> --- a/fs/hfs/brec.c
> +++ b/fs/hfs/brec.c
> @@ -272,8 +272,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
> /* panic? */
> hfs_bnode_put(node);
> hfs_bnode_put(new_node);
> - if (next_node)
> - hfs_bnode_put(next_node);
> + hfs_bnode_put(next_node);
> return ERR_PTR(-ENOSPC);
> }
>
> diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c
> index c1422d9..7be88e3 100644
> --- a/fs/hfsplus/bfind.c
> +++ b/fs/hfsplus/bfind.c
> @@ -171,8 +171,7 @@ int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare)
> int height, res;
>
> tree = fd->tree;
> - if (fd->bnode)
> - hfs_bnode_put(fd->bnode);
> + hfs_bnode_put(fd->bnode);
> fd->bnode = NULL;
> nidx = tree->root;
> if (!nidx)
> diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
> index 6e560d5..59bab47 100644
> --- a/fs/hfsplus/brec.c
> +++ b/fs/hfsplus/brec.c
> @@ -276,8 +276,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
> /* panic? */
> hfs_bnode_put(node);
> hfs_bnode_put(new_node);
> - if (next_node)
> - hfs_bnode_put(next_node);
> + hfs_bnode_put(next_node);
> return ERR_PTR(-ENOSPC);
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] fs-eventpoll: Deletion of unnecessary checks before the function call "__pm_stay_awake"
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-17 18:19 ` [PATCH 1/1] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put" SF Markus Elfring
@ 2014-11-18 8:35 ` SF Markus Elfring
2015-06-26 17:42 ` [PATCH] " SF Markus Elfring
2014-11-18 11:20 ` [PATCH 1/1] fs-namespace: Deletion of unnecessary checks before the function call "mntput" SF Markus Elfring
2014-11-29 16:03 ` [PATCH 1/1] fs-namei: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2014-11-18 8:35 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel; +Cc: LKML, kernel-janitors, Coccinelle
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Nov 2014 09:27:16 +0100
The __pm_stay_awake() 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>
---
fs/eventpoll.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 7bcfff9..eec2e85 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -555,8 +555,7 @@ static inline void ep_pm_stay_awake(struct epitem *epi)
{
struct wakeup_source *ws = ep_wakeup_source(epi);
- if (ws)
- __pm_stay_awake(ws);
+ __pm_stay_awake(ws);
}
static inline bool ep_has_wakeup_source(struct epitem *epi)
@@ -571,8 +570,7 @@ static inline void ep_pm_stay_awake_rcu(struct epitem *epi)
rcu_read_lock();
ws = rcu_dereference(epi->ws);
- if (ws)
- __pm_stay_awake(ws);
+ __pm_stay_awake(ws);
rcu_read_unlock();
}
--
2.1.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/1] fs-namespace: Deletion of unnecessary checks before the function call "mntput"
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-17 18:19 ` [PATCH 1/1] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put" SF Markus Elfring
2014-11-18 8:35 ` [PATCH 1/1] fs-eventpoll: Deletion of unnecessary checks before the function call "__pm_stay_awake" SF Markus Elfring
@ 2014-11-18 11:20 ` SF Markus Elfring
2015-07-04 9:26 ` [PATCH] fs-namespace: Delete " SF Markus Elfring
2014-11-29 16:03 ` [PATCH 1/1] fs-namei: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2014-11-18 11:20 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel; +Cc: LKML, kernel-janitors, Coccinelle
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Nov 2014 12:10:43 +0100
The mntput() 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>
---
fs/namespace.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 550dbff..3b3710e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2615,10 +2615,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
}
namespace_unlock();
- if (rootmnt)
- mntput(rootmnt);
- if (pwdmnt)
- mntput(pwdmnt);
+ mntput(rootmnt);
+ mntput(pwdmnt);
return new_ns;
}
--
2.1.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/1] fs-namei: Deletion of an unnecessary check before the function call "iput"
[not found] ` <5317A59D.4@users.sourceforge.net>
` (2 preceding siblings ...)
2014-11-18 11:20 ` [PATCH 1/1] fs-namespace: Deletion of unnecessary checks before the function call "mntput" SF Markus Elfring
@ 2014-11-29 16:03 ` SF Markus Elfring
3 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2014-11-29 16:03 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel; +Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 29 Nov 2014 17:00:21 +0100
The iput() 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>
---
fs/namei.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index ca81416..ce69074 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3759,8 +3759,7 @@ exit2:
dput(dentry);
}
mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
- if (inode)
- iput(inode); /* truncate the inode here */
+ iput(inode); /* truncate the inode here */
inode = NULL;
if (delegated_inode) {
error = break_deleg_wait(&delegated_inode);
--
2.1.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] fs-eventpoll: Deletion of unnecessary checks before the function call "__pm_stay_awake"
2014-11-18 8:35 ` [PATCH 1/1] fs-eventpoll: Deletion of unnecessary checks before the function call "__pm_stay_awake" SF Markus Elfring
@ 2015-06-26 17:42 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2015-06-26 17:42 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel; +Cc: LKML, kernel-janitors, Julia Lawall
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 18 Nov 2014 09:27:16 +0100
>
> The __pm_stay_awake() 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>
> ---
> fs/eventpoll.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> index 7bcfff9..eec2e85 100644
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -555,8 +555,7 @@ static inline void ep_pm_stay_awake(struct epitem *epi)
> {
> struct wakeup_source *ws = ep_wakeup_source(epi);
>
> - if (ws)
> - __pm_stay_awake(ws);
> + __pm_stay_awake(ws);
> }
>
> static inline bool ep_has_wakeup_source(struct epitem *epi)
> @@ -571,8 +570,7 @@ static inline void ep_pm_stay_awake_rcu(struct epitem *epi)
>
> rcu_read_lock();
> ws = rcu_dereference(epi->ws);
> - if (ws)
> - __pm_stay_awake(ws);
> + __pm_stay_awake(ws);
> rcu_read_unlock();
> }
>
>
How are the chances to integrate this update suggestion
into another source code repository?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put"
2014-11-17 19:18 ` Vyacheslav Dubeyko
@ 2015-06-29 13:40 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2015-06-29 13:40 UTC (permalink / raw)
To: Vyacheslav Dubeyko, linux-fsdevel; +Cc: LKML, kernel-janitors, Julia Lawall
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Mon, 17 Nov 2014 19:13:56 +0100
>>
>> The hfs_bnode_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.
>>
>
> Thank you. It's the reasonable correction. Looks good for me.
>
> Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
>
> Thanks,
> Vyacheslav Dubeyko.
>
>> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>> ---
>> fs/hfs/bfind.c | 3 +--
>> fs/hfs/brec.c | 3 +--
>> fs/hfsplus/bfind.c | 3 +--
>> fs/hfsplus/brec.c | 3 +--
>> 4 files changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
>> index de69d8a..0e26523 100644
>> --- a/fs/hfs/bfind.c
>> +++ b/fs/hfs/bfind.c
>> @@ -100,8 +100,7 @@ int hfs_brec_find(struct hfs_find_data *fd)
>> int height, res;
>>
>> tree = fd->tree;
>> - if (fd->bnode)
>> - hfs_bnode_put(fd->bnode);
>> + hfs_bnode_put(fd->bnode);
>> fd->bnode = NULL;
>> nidx = tree->root;
>> if (!nidx)
>> diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
>> index 9f4ee7f..3a52b2c 100644
>> --- a/fs/hfs/brec.c
>> +++ b/fs/hfs/brec.c
>> @@ -272,8 +272,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
>> /* panic? */
>> hfs_bnode_put(node);
>> hfs_bnode_put(new_node);
>> - if (next_node)
>> - hfs_bnode_put(next_node);
>> + hfs_bnode_put(next_node);
>> return ERR_PTR(-ENOSPC);
>> }
>>
>> diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c
>> index c1422d9..7be88e3 100644
>> --- a/fs/hfsplus/bfind.c
>> +++ b/fs/hfsplus/bfind.c
>> @@ -171,8 +171,7 @@ int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare)
>> int height, res;
>>
>> tree = fd->tree;
>> - if (fd->bnode)
>> - hfs_bnode_put(fd->bnode);
>> + hfs_bnode_put(fd->bnode);
>> fd->bnode = NULL;
>> nidx = tree->root;
>> if (!nidx)
>> diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
>> index 6e560d5..59bab47 100644
>> --- a/fs/hfsplus/brec.c
>> +++ b/fs/hfsplus/brec.c
>> @@ -276,8 +276,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
>> /* panic? */
>> hfs_bnode_put(node);
>> hfs_bnode_put(new_node);
>> - if (next_node)
>> - hfs_bnode_put(next_node);
>> + hfs_bnode_put(next_node);
>> return ERR_PTR(-ENOSPC);
>> }
>>
>
>
Can this update suggestion be still integrated
into another source code repository?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] fs-namespace: Delete unnecessary checks before the function call "mntput"
2014-11-18 11:20 ` [PATCH 1/1] fs-namespace: Deletion of unnecessary checks before the function call "mntput" SF Markus Elfring
@ 2015-07-04 9:26 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2015-07-04 9:26 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel
Cc: Linux Kernel Mailing List, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 4 Jul 2015 11:21:17 +0200
The mntput() 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>
---
fs/namespace.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index e0b2f36..bc689bd 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2809,12 +2809,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
p = next_mnt(p, old);
}
namespace_unlock();
-
- if (rootmnt)
- mntput(rootmnt);
- if (pwdmnt)
- mntput(pwdmnt);
-
+ mntput(rootmnt);
+ mntput(pwdmnt);
return new_ns;
}
--
2.4.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-07-04 9:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5307CAA2.8060406@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
[not found] ` <530A086E.8010901@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
[not found] ` <530A72AA.3000601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
[not found] ` <530B5FB6.6010207@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
[not found] ` <530C5E18.1020800@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
[not found] ` <530CD2C4.4050903@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
[not found] ` <530CF8FF.8080600@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
[not found] ` <530DD06F.4090703@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
[not found] ` <5317A59D.4@users.so urceforge.net>
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-17 18:19 ` [PATCH 1/1] hfs/hfs+: Deletion of unnecessary checks before the function call "hfs_bnode_put" SF Markus Elfring
2014-11-17 19:18 ` Vyacheslav Dubeyko
2015-06-29 13:40 ` [PATCH] " SF Markus Elfring
2014-11-18 8:35 ` [PATCH 1/1] fs-eventpoll: Deletion of unnecessary checks before the function call "__pm_stay_awake" SF Markus Elfring
2015-06-26 17:42 ` [PATCH] " SF Markus Elfring
2014-11-18 11:20 ` [PATCH 1/1] fs-namespace: Deletion of unnecessary checks before the function call "mntput" SF Markus Elfring
2015-07-04 9:26 ` [PATCH] fs-namespace: Delete " SF Markus Elfring
2014-11-29 16:03 ` [PATCH 1/1] fs-namei: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).