drivers: block: Updates return value check
Subsystems (2)
PATCH 1/1 drivers: block: Updates return value check
Updating the check of return value from debugfs_create_dir to use IS_ERR.
--- drivers/block/nbd.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/block/nbd.c +2 -2
@@ -1666,7 +1666,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)return -EIO ; dir =debugfs_create_dir (nbd_name (nbd), nbd_dbg_dir); -if (!dir) { +if (IS_ERR (dir)) {dev_err (nbd_to_dev (nbd),"Failed to create debugfs dir for '%s'\n" ,nbd_name (nbd));return -EIO ;
@@ -1692,7 +1692,7 @@ static int nbd_dbg_init(void)struct dentry *dbg_dir; dbg_dir =debugfs_create_dir ("nbd" ,NULL ); -if (!dbg_dir) +if (IS_ERR (dbg_dir))return -EIO ; nbd_dbg_dir = dbg_dir;
drivers/block/pktcdvd.c +1 -1
@@ -451,7 +451,7 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)if (!pkt_debugfs_root)return ; pd->dfs_d_root =debugfs_create_dir (pd->name, pkt_debugfs_root); -if (!pd->dfs_d_root) +if (IS_ERR (pd->dfs_d_root))return ; pd->dfs_f_info = debugfs_create_file("info", 0444,
Signature · 1 line
2.25.1
Quoted 2 lines · Atul Kumar Pant
Updating the check of return value from
debugfs_create_dirto useIS_ERR.
Why?
Quoted 12 lines
Signed-off-by Atul Kumar Pant <[email protected]>--- drivers/block/nbd.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/block/nbd.c +0
-0
drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd) · line 1672
Quoted 8 lines
drivers/block/nbd.c +1
-1@@ -1666,7 +1666,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)return -EIO ; dir =debugfs_create_dir (nbd_name (nbd), nbd_dbg_dir); -if (!dir) { +if (IS_ERR (dir)) {dev_err (nbd_to_dev (nbd),"Failed to create debugfs dir for '%s'\n" ,nbd_name (nbd));return -EIO ;
This isn't correct, sorry. Please do not make this change.
drivers/block/nbd.c static int nbd_dbg_init(void) · line 1696
Quoted 7 lines
drivers/block/nbd.c +1
-1@@ -1692,7 +1692,7 @@ static int nbd_dbg_init(void)struct dentry *dbg_dir; dbg_dir =debugfs_create_dir ("nbd" ,NULL ); -if (!dbg_dir) +if (IS_ERR (dbg_dir))return -EIO ;
Again, not corrct.
drivers/block/pktcdvd.c static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) · line 455
Quoted 12 lines
drivers/block/nbd.c +0
-0nbd_dbg_dir = dbg_dir;drivers/block/pktcdvd.c +1
-1@@ -451,7 +451,7 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)if (!pkt_debugfs_root)return ; pd->dfs_d_root =debugfs_create_dir (pd->name, pkt_debugfs_root); -if (!pd->dfs_d_root) +if (IS_ERR (pd->dfs_d_root))return ;
Also not correct.
Why check the return value at all? As this check has always been wrong, why are you wanting to keep it?
Also, you never responded to our previous review comments, why not? To ignore people is not generally considered a good idea :(
greg k-h
Quoted 54 lines · Greg KH
Quoted 2 lines · Atul Kumar Pant
Updating the check of return value from
debugfs_create_dirto useIS_ERR.Why?
Quoted 12 lines
Signed-off-by Atul Kumar Pant <[email protected]>--- drivers/block/nbd.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/block/nbd.c +0
-0drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd) · line 1672
Quoted 8 lines
drivers/block/nbd.c +1
-1@@ -1666,7 +1666,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)return -EIO ; dir =debugfs_create_dir (nbd_name (nbd), nbd_dbg_dir); -if (!dir) { +if (IS_ERR (dir)) {dev_err (nbd_to_dev (nbd),"Failed to create debugfs dir for '%s'\n" ,nbd_name (nbd));return -EIO ;This isn't correct, sorry. Please do not make this change.
drivers/block/nbd.c static int nbd_dbg_init(void) · line 1696
Quoted 7 lines
drivers/block/nbd.c +1
-1@@ -1692,7 +1692,7 @@ static int nbd_dbg_init(void)struct dentry *dbg_dir; dbg_dir =debugfs_create_dir ("nbd" ,NULL ); -if (!dbg_dir) +if (IS_ERR (dbg_dir))return -EIO ;Again, not corrct.
drivers/block/pktcdvd.c static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) · line 455
Quoted 12 lines
drivers/block/nbd.c +0
-0nbd_dbg_dir = dbg_dir;drivers/block/pktcdvd.c +1
-1@@ -451,7 +451,7 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)if (!pkt_debugfs_root)return ; pd->dfs_d_root =debugfs_create_dir (pd->name, pkt_debugfs_root); -if (!pd->dfs_d_root) +if (IS_ERR (pd->dfs_d_root))return ;Also not correct.
Quoted 2 lines
Why check the return value at all? As this check has always been wrong, why are you wanting to keep it?
I'll check the code again. I was not aware that this check is wrong, so just tried to fix this based on return value of debugfs_create_dir.
Quoted 3 lines
Also, you never responded to our previous review comments, why not? To ignore people is not generally considered a good idea :(
I might have missed seeing your comments hence I did not reply back.
Please accept my sincere apologies for this.
I have one confusion though, regarding the comments that you are
referring to. Are you mentioning about this patch? Re: [PATCH v5] selftests: rtc: Improve rtctest error handling Here I got the following response from your email bot -
Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all.
Maybe I misunderstood this comment and hence did not reply/do
anything in response to Markus's comments.
If you were referring to some other patch then if possible, can you please tell me the suject of the patch? I will reply to your comments and will make the fixes accordingly.
Quoted 2 lines
greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 55 lines · Atul Kumar Pant
Quoted 54 lines · Greg KH
Quoted 2 lines · Atul Kumar Pant
Updating the check of return value from
debugfs_create_dirto useIS_ERR.Why?
Quoted 12 lines
Signed-off-by Atul Kumar Pant <[email protected]>--- drivers/block/nbd.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/block/nbd.c +0
-0drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd) · line 1672
Quoted 8 lines
drivers/block/nbd.c +1
-1@@ -1666,7 +1666,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)return -EIO ; dir =debugfs_create_dir (nbd_name (nbd), nbd_dbg_dir); -if (!dir) { +if (IS_ERR (dir)) {dev_err (nbd_to_dev (nbd),"Failed to create debugfs dir for '%s'\n" ,nbd_name (nbd));return -EIO ;This isn't correct, sorry. Please do not make this change.
drivers/block/nbd.c static int nbd_dbg_init(void) · line 1696
Quoted 7 lines
drivers/block/nbd.c +1
-1@@ -1692,7 +1692,7 @@ static int nbd_dbg_init(void)struct dentry *dbg_dir; dbg_dir =debugfs_create_dir ("nbd" ,NULL ); -if (!dbg_dir) +if (IS_ERR (dbg_dir))return -EIO ;Again, not corrct.
drivers/block/pktcdvd.c static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) · line 455
Quoted 12 lines
drivers/block/nbd.c +0
-0nbd_dbg_dir = dbg_dir;drivers/block/pktcdvd.c +1
-1@@ -451,7 +451,7 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)if (!pkt_debugfs_root)return ; pd->dfs_d_root =debugfs_create_dir (pd->name, pkt_debugfs_root); -if (!pd->dfs_d_root) +if (IS_ERR (pd->dfs_d_root))return ;Also not correct.
Quoted 6 lines
Quoted 2 lines
Why check the return value at all? As this check has always been wrong, why are you wanting to keep it?
I'll check the code again. I was not aware that this check is wrong, so just tried to fix this based on return value of
debugfs_create_dir.
The return value of debugfs_create_dir() should never need to be checked at all. The value passed in can be later used in any debugfs call safely, be it an error or success. The kernel logic should NOT change based on if debugfs is working properly or not.
So for stuff like this, where the check is obviously wrong (i.e. it's never caught an error, it's even more of a good idea to remove the check.
Quoted 6 lines
Quoted 3 lines
Also, you never responded to our previous review comments, why not? To ignore people is not generally considered a good idea :(
I might have missed seeing your comments hence I did not reply back. Please accept my sincere apologies for this.
Oops, nope, my apologies, this was my fault. I got you confused with a different developer sending patches to the kernel-mentees mailing list with the same first name. I should have checked better, again my fault, sorry.
So all is good with your responses, but you should fix these up to NOT check the return value at all.
thanks,
greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 63 lines · Greg KH
Quoted 55 lines · Atul Kumar Pant
Quoted 54 lines · Greg KH
Quoted 2 lines · Atul Kumar Pant
Updating the check of return value from
debugfs_create_dirto useIS_ERR.Why?
Quoted 12 lines
Signed-off-by Atul Kumar Pant <[email protected]>--- drivers/block/nbd.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/block/nbd.c +0
-0drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd) · line 1672
Quoted 8 lines
drivers/block/nbd.c +1
-1@@ -1666,7 +1666,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)return -EIO ; dir =debugfs_create_dir (nbd_name (nbd), nbd_dbg_dir); -if (!dir) { +if (IS_ERR (dir)) {dev_err (nbd_to_dev (nbd),"Failed to create debugfs dir for '%s'\n" ,nbd_name (nbd));return -EIO ;This isn't correct, sorry. Please do not make this change.
drivers/block/nbd.c static int nbd_dbg_init(void) · line 1696
Quoted 7 lines
drivers/block/nbd.c +1
-1@@ -1692,7 +1692,7 @@ static int nbd_dbg_init(void)struct dentry *dbg_dir; dbg_dir =debugfs_create_dir ("nbd" ,NULL ); -if (!dbg_dir) +if (IS_ERR (dbg_dir))return -EIO ;Again, not corrct.
drivers/block/pktcdvd.c static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) · line 455
Quoted 12 lines
drivers/block/nbd.c +0
-0nbd_dbg_dir = dbg_dir;drivers/block/pktcdvd.c +1
-1@@ -451,7 +451,7 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)if (!pkt_debugfs_root)return ; pd->dfs_d_root =debugfs_create_dir (pd->name, pkt_debugfs_root); -if (!pd->dfs_d_root) +if (IS_ERR (pd->dfs_d_root))return ;Also not correct.
Quoted 6 lines
Quoted 2 lines
Why check the return value at all? As this check has always been wrong, why are you wanting to keep it?
I'll check the code again. I was not aware that this check is wrong, so just tried to fix this based on return value of
debugfs_create_dir.
Quoted 8 lines
The return value of
debugfs_create_dir()should never need to be checked at all. The value passed in can be later used in any debugfs call safely, be it an error or success. The kernel logic should NOT change based on if debugfs is working properly or not.So for stuff like this, where the check is obviously wrong (i.e. it's never caught an error, it's even more of a good idea to remove the check.
Understood. I'll fix this in a new patch.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Also, you never responded to our previous review comments, why not? To ignore people is not generally considered a good idea :(
Quoted 8 lines
Quoted 2 lines
I might have missed seeing your comments hence I did not reply back. Please accept my sincere apologies for this.
Oops, nope, my apologies, this was my fault. I got you confused with a different developer sending patches to the kernel-mentees mailing list with the same first name. I should have checked better, again my fault, sorry.
No worries!
Quoted 6 lines
So all is good with your responses, but you should fix these up to NOT check the return value at all.
thanks,
greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees