Staging: rtl872bs: Remove local variables in functions
PATCH 1/1 Staging: rtl872bs: Remove local variables in functions
Remove declarations of local variables in functions rtw_init_cmd_priv and rtw_init_evt_priv.
Issue suggested by Coccinelle using ret.cocci.
--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +2 -8
@@ -297,18 +297,12 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)u32 rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -u32 res; - - res =_rtw_init_cmd_priv (pcmdpriv); -return res; +return _rtw_init_cmd_priv (pcmdpriv); }u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) { -int res; - - res =_rtw_init_evt_priv (pevtpriv); -return res; +return _rtw_init_evt_priv (pevtpriv); }void rtw_free_evt_priv (struct evt_priv *pevtpriv)
Signature · 1 line
2.17.1
Quoted 22 lines · Madhumitha Prabakaran
Remove declarations of local variables in functions
rtw_init_cmd_privandrtw_init_evt_priv.
Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4@@ -297,18 +297,12 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)u32 rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -u32 res; - - res =_rtw_init_cmd_priv (pcmdpriv); -return res; +return _rtw_init_cmd_priv (pcmdpriv);
drivers/staging/rtl8723bs/core/rtw_cmd.c struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) · line 306
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4}u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) { -int res; - - res =_rtw_init_evt_priv (pevtpriv); -return res; +return _rtw_init_evt_priv (pevtpriv); }
I wonder if there is something more drastic that you could do here. The functions that these functions call (the ones with the _s) are called only once. They have a different return type (sint) than these functions (u32). They are declared as extern, but they are only used in the file in which they are defined. It looks like things could be greatly simplified.
julia
Quoted 12 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +0
-1void rtw_free_evt_priv (struct evt_priv *pevtpriv) --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313155425.5548-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 51 lines · Julia Lawall
Quoted 22 lines · Madhumitha Prabakaran
Remove declarations of local variables in functions
rtw_init_cmd_privandrtw_init_evt_priv.
Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4@@ -297,18 +297,12 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)u32 rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -u32 res; - - res =_rtw_init_cmd_priv (pcmdpriv); -return res; +return _rtw_init_cmd_priv (pcmdpriv);drivers/staging/rtl8723bs/core/rtw_cmd.c struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) · line 306
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4}u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) { -int res; - - res =_rtw_init_evt_priv (pevtpriv); -return res; +return _rtw_init_evt_priv (pevtpriv); }I wonder if there is something more drastic that you could do here. The functions that these functions call (the ones with the _s) are called only once. They have a different return type (sint) than these functions (u32). They are declared as extern, but they are only used in the file in which they are defined. It looks like things could be greatly simplified.
julia
Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +0
-1void rtw_free_evt_priv (struct evt_priv *pevtpriv) --2.17.1
Quoted 14 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313155425.5548-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903132045230.2515%40hadrien. For more options, visit https://groups.google.com/d/optout.
Should I submit this as patch series, along with other modified file.
Thanks,
Madhumitha
Quoted 60 lines · Madhumthia Prabakaran
Quoted 59 lines · Julia Lawall
Quoted 22 lines · Madhumitha Prabakaran
Remove declarations of local variables in functions
rtw_init_cmd_privandrtw_init_evt_priv.
Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4@@ -297,18 +297,12 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)u32 rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -u32 res; - - res =_rtw_init_cmd_priv (pcmdpriv); -return res; +return _rtw_init_cmd_priv (pcmdpriv);drivers/staging/rtl8723bs/core/rtw_cmd.c struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) · line 306
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4}u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) { -int res; - - res =_rtw_init_evt_priv (pevtpriv); -return res; +return _rtw_init_evt_priv (pevtpriv); }I wonder if there is something more drastic that you could do here. The functions that these functions call (the ones with the _s) are called only once. They have a different return type (sint) than these functions (u32). They are declared as extern, but they are only used in the file in which they are defined. It looks like things could be greatly simplified.
julia
Quoted 12 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +0
-1void rtw_free_evt_priv (struct evt_priv *pevtpriv) --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313155425.5548-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 8 lines
Quoted 6 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903132045230.2515%40hadrien.
For more options, visit https://groups.google.com/d/optout.Should I submit this as patch series, along with other modified file.
I'm not sure to understand the question. I expect that the changes I suggest above would need to be in one patch, because the kernel has to be able to compiler after each patch is applied.
Please respond to messages right below the text you are responding to, and not at the end of the message. There is currently a good chance that your comments will be missed, because one doesn't pay much attention to what comes after the bla bla bla information about the group.
julia
Quoted 77 lines · Julia Lawall
Quoted 60 lines · Madhumthia Prabakaran
Quoted 59 lines · Julia Lawall
Quoted 22 lines · Madhumitha Prabakaran
Remove declarations of local variables in functions
rtw_init_cmd_privandrtw_init_evt_priv.
Issue suggested by Coccinelle usingret.cocci.Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4@@ -297,18 +297,12 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)u32 rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -u32 res; - - res =_rtw_init_cmd_priv (pcmdpriv); -return res; +return _rtw_init_cmd_priv (pcmdpriv);drivers/staging/rtl8723bs/core/rtw_cmd.c struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) · line 306
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +1
-4}u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) { -int res; - - res =_rtw_init_evt_priv (pevtpriv); -return res; +return _rtw_init_evt_priv (pevtpriv); }I wonder if there is something more drastic that you could do here. The functions that these functions call (the ones with the _s) are called only once. They have a different return type (sint) than these functions (u32). They are declared as extern, but they are only used in the file in which they are defined. It looks like things could be greatly simplified.
julia
Quoted 12 lines
drivers/staging/rtl8723bs/core/rtw_cmd.c +0
-1void rtw_free_evt_priv (struct evt_priv *pevtpriv) --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313155425.5548-1-madhumithabiw%40gmail.com.
For more options, visit https://groups.google.com/d/optout.Quoted 8 lines
Quoted 6 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903132045230.2515%40hadrien.
For more options, visit https://groups.google.com/d/optout.Should I submit this as patch series, along with other modified file.
I'm not sure to understand the question. I expect that the changes I suggest above would need to be in one patch, because the kernel has to be able to compiler after each patch is applied.
Quoted 13 lines
Please respond to messages right below the text you are responding to, and not at the end of the message. There is currently a good chance that your comments will be missed, because one doesn't pay much attention to what comes after the bla bla bla information about the group.
julia
Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903132304420.2515%40hadrien. For more options, visit https://groups.google.com/d/optout.
The change need to be made in two files - drivers/staging/rtl8723bs/core/rtw_cmd.c
1) drivers/staging/rtl8723bs/core/rtw_cmd.c
2) drivers/staging/rtl8723bs/include/cmd_osdep.h (to remove extern from function prototypes)
So that's reason why I asked whether it has to be send as patch series or I can submit it as individual patches.
In rtw_cmd.c, along with the change already made, I will change the return expression. i.e.
Quoted 3 lines
The change need to be made in two files -
drivers/staging/rtl8723bs/core/rtw_cmd.c
1)drivers/staging/rtl8723bs/core/rtw_cmd.c
2)drivers/staging/rtl8723bs/include/cmd_osdep.h(to remove extern from function prototypes)
If you change the .c file in the first patch and the .h file in the second patch, then the first patch will break the build. On the other hand, if you change the .h file in the first patch that will not change anything, because no one cares about the declaration.
Still I think it would make sense to do the whole thing at once, in a single patch. A function definition and its prototype go together, so if you change both it would make the most sense to do the whole thing at once.
Quoted 1 line
So that's reason why I asked whether it has to be send as patch series or I can submit it as individual patches.
Not individual patches. Either a series with the .h file first and then the change in the .c file, or a single patch.
Quoted 2 lines
In
rtw_cmd.c, along with the change already made, I will change the return expression. i.e.
Your message got broken off here, But you don't want the change already made. There is no point to have a function that has the only statement to call another function. The two functions that you changed should just be dropped completely.
Again, please put your replies inline after the text that you are replying to and not at the very end of the message, after the list management information.
julia
Quoted 4 lines · Julia Lawall
Quoted 3 lines
The change need to be made in two files -
drivers/staging/rtl8723bs/core/rtw_cmd.c
1)drivers/staging/rtl8723bs/core/rtw_cmd.c
2)drivers/staging/rtl8723bs/include/cmd_osdep.h(to remove extern from function prototypes)
Quoted 8 lines
If you change the .c file in the first patch and the .h file in the second patch, then the first patch will break the build. On the other hand, if you change the .h file in the first patch that will not change anything, because no one cares about the declaration.
Still I think it would make sense to do the whole thing at once, in a single patch. A function definition and its prototype go together, so if you change both it would make the most sense to do the whole thing at once.
Will fix as a patch.
Quoted 7 lines
Quoted 2 lines
So that's reason why I asked whether it has to be send as patch series or I can submit it as individual patches.
Not individual patches. Either a series with the .h file first and then the change in the .c file, or a single patch.
Quoted 7 lines
Quoted 2 lines
In
rtw_cmd.c, along with the change already made, I will change the return expression. i.e.Your message got broken off here, But you don't want the change already made. There is no point to have a function that has the only statement to call another function.The two functions that you changed should just be dropped completely.
I will drop the patch. But the function is calling same function with different return type. I never encountered this type of function in C. This is function overloading in C++. Based on Brian and Dennis, only change I can make on that function I can edit the return type with return (u32) _rtw_init_cmd_priv(pcmdpriv).
Am I thinking straight for fixing it? Need for suggestions?
Quoted 13 lines
Again, please put your replies inline after the text that you are replying to and not at the very end of the message, after the list management information.
julia
Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903140708190.2814%40hadrien. For more options, visit https://groups.google.com/d/optout.
Quoted 30 lines · Madhumthia Prabakaran
Quoted 4 lines · Julia Lawall
Quoted 3 lines
The change need to be made in two files -
drivers/staging/rtl8723bs/core/rtw_cmd.c
1)drivers/staging/rtl8723bs/core/rtw_cmd.c
2)drivers/staging/rtl8723bs/include/cmd_osdep.h(to remove extern from function prototypes)Quoted 8 lines
If you change the .c file in the first patch and the .h file in the second patch, then the first patch will break the build. On the other hand, if you change the .h file in the first patch that will not change anything, because no one cares about the declaration.
Still I think it would make sense to do the whole thing at once, in a single patch. A function definition and its prototype go together, so if you change both it would make the most sense to do the whole thing at once.
Will fix as a patch.
Quoted 7 lines
Quoted 2 lines
So that's reason why I asked whether it has to be send as patch series or I can submit it as individual patches.
Not individual patches. Either a series with the .h file first and then the change in the .c file, or a single patch.
Quoted 7 lines
Quoted 2 lines
In
rtw_cmd.c, along with the change already made, I will change the return expression. i.e.Your message got broken off here, But you don't want the change already made. There is no point to have a function that has the only statement to call another function.The two functions that you changed should just be dropped completely.
Quoted 6 lines
I will drop the patch. But the function is calling same function with different return type. I never encountered this type of function in C. This is function overloading in C++. Based on Brian and Dennis, only change I can make on that function I can edit the return type with return (u32)
_rtw_init_cmd_priv(pcmdpriv).
Am I thinking straight for fixing it? Need for suggestions?
You should get rid of the functions that you previously modified. Remove the _s from the names of the functions that they call and change the return types. Check in the function body to see if changing the return types causes any problem. I haven't looked at those function definitions.
julia
Quoted 22 lines
Quoted 6 lines
Again, please put your replies inline after the text that you are replying to and not at the very end of the message, after the list management information.
Quoted 8 lines
julia
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903140708190.2814%40hadrien.
For more options, visit https://groups.google.com/d/optout.--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190314160338.GA14192%40madhuleo.
For more options, visit https://groups.google.com/d/optout.
Quoted 41 lines · Julia Lawall
Quoted 30 lines · Madhumthia Prabakaran
Quoted 4 lines · Julia Lawall
Quoted 3 lines
The change need to be made in two files -
drivers/staging/rtl8723bs/core/rtw_cmd.c
1)drivers/staging/rtl8723bs/core/rtw_cmd.c
2)drivers/staging/rtl8723bs/include/cmd_osdep.h(to remove extern from function prototypes)Quoted 8 lines
If you change the .c file in the first patch and the .h file in the second patch, then the first patch will break the build. On the other hand, if you change the .h file in the first patch that will not change anything, because no one cares about the declaration.
Still I think it would make sense to do the whole thing at once, in a single patch. A function definition and its prototype go together, so if you change both it would make the most sense to do the whole thing at once.
Will fix as a patch.
Quoted 7 lines
Quoted 2 lines
So that's reason why I asked whether it has to be send as patch series or I can submit it as individual patches.
Not individual patches. Either a series with the .h file first and then the change in the .c file, or a single patch.
Quoted 7 lines
Quoted 2 lines
In
rtw_cmd.c, along with the change already made, I will change the return expression. i.e.Your message got broken off here, But you don't want the change already made. There is no point to have a function that has the only statement to call another function.The two functions that you changed should just be dropped completely.
Quoted 6 lines
I will drop the patch. But the function is calling same function with different return type. I never encountered this type of function in C. This is function overloading in C++. Based on Brian and Dennis, only change I can make on that function I can edit the return type with return (u32)
_rtw_init_cmd_priv(pcmdpriv).
Am I thinking straight for fixing it? Need for suggestions?
Quoted 5 lines
You should get rid of the functions that you previously modified. Remove the _s from the names of the functions that they call and change the return types. Check in the function body to see if changing the return types causes any problem. I haven't looked at those function definitions.
Sorry I missed the _s in both the functions and assumed that both are same functions with different return type. So I can't able to think properly.
Thanks.
Quoted 32 lines
julia
Quoted 22 lines
Quoted 6 lines
Again, please put your replies inline after the text that you are replying to and not at the very end of the message, after the list management information.
Quoted 8 lines
julia
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903140708190.2814%40hadrien.
For more options, visit https://groups.google.com/d/optout.--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190314160338.GA14192%40madhuleo.
For more options, visit https://groups.google.com/d/optout.Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903142050180.2749%40hadrien. For more options, visit https://groups.google.com/d/optout.