Staging: rtlwifi: Remove unnecessary 'out of memory' message.
PATCH v2 1/1 Staging: rtlwifi: Remove unnecessary 'out of memory' message.
This patch removes unnecessary 'out of memory' message to make the code more efficient.
Problem found by checkpatch.
---
Changes in v2:
-Add a tab before the return statement.
drivers/staging/rtlwifi/rc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtlwifi/rc.c +1 -3
@@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv,struct rtl_rate_priv *rate_priv; rate_priv =kzalloc (sizeof (*rate_priv), gfp); -if (!rate_priv) { -pr_err ("Unable to allocate private rc structure\n" ); +if (!rate_priv)return NULL ; - } rtlpriv->rate_priv = rate_priv;
Signature · 1 line
2.7.4
Quoted 2 lines · Shreeya Patel
This patch removes unnecessary 'out of memory' message to make the code more efficient.
I'm not sure it is really an efficiency issue. The kzalloc will probably indeed never fail in practice. And if it does, the system is probably in a state where efficiency doesn't matter. On the other hand, regardless of whether the error occurs or not, the string will take up memory, and anyway, it is redundant, because kzalloc will emit a backtrace on error that will point to this call site.
julia
Quoted 38 lines
Problem found by checkpatch.
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2:
-Add a tab before the return statement.drivers/staging/rtlwifi/rc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/rtlwifi/rc.c +1
-4@@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv,struct rtl_rate_priv *rate_priv; rate_priv =kzalloc (sizeof (*rate_priv), gfp); -if (!rate_priv) { -pr_err ("Unable to allocate private rc structure\n" ); +if (!rate_priv)return NULL ; - } rtlpriv->rate_priv = rate_priv; --2.7.4
--
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/1504983347-2957-1-git-send-email-shreeya.patel23498%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 5 lines · Julia Lawall
Quoted 2 lines · Shreeya Patel
This patch removes unnecessary 'out of memory' message to make the code more efficient.
Quoted 8 lines
I'm not sure it is really an efficiency issue. The kzalloc will probably indeed never fail in practice. And if it does, the system is probably in a state where efficiency doesn't matter. On the other hand, regardless of whether the error occurs or not, the string will take up memory, and anyway, it is redundant, because kzalloc will emit a backtrace on error that will point to this call site.
julia
Ok. I will find out the actual reason that why this warning was put up by the developer and will re-send the patch.
Quoted 39 lines
Quoted 39 lines
Problem found by checkpatch.
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2:
-Add a tab before the return statement.drivers/staging/rtlwifi/rc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/rtlwifi/rc.c +1
-4@@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv,struct rtl_rate_priv *rate_priv; rate_priv =kzalloc (sizeof (*rate_priv), gfp); -if (!rate_priv) { -pr_err ("Unable to allocate private rc structure\n" ); +if (!rate_priv)return NULL ; - } rtlpriv->rate_priv = rate_priv; --2.7.4
--
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/1504983347-2957-1-git-send-email-shreeya.patel23498%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
I would like to notify that I had sent the first version of this patch to my mentor Julia lawall. Also this patch is showing me some false positive errors of whitespace.
There are no errors in the file which i have modified and also in the commit message.
Quoted 30 lines · Shreeya Patel
This patch removes unnecessary 'out of memory' message to make the code more efficient.
Problem found by checkpatch.
Signed-off-by Shreeya Patel <[email protected]>---
Changes in v2:
-Add a tab before the return statement.drivers/staging/rtlwifi/rc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/rtlwifi/rc.c +1
-3@@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv,struct rtl_rate_priv *rate_priv; rate_priv =kzalloc (sizeof (*rate_priv), gfp); -if (!rate_priv) { -pr_err ("Unable to allocate private rc structure\n" ); +if (!rate_priv)return NULL ; - } rtlpriv->rate_priv = rate_priv;
Quoted 34 lines · Shreeya Patel
This patch removes unnecessary 'out of memory' message to make the code more efficient.
Problem found by checkpatch.
Signed-off-by Shreeya Patel <[email protected] <javascript:>>---
Changes in v2:
-Add a tab before the return statement.drivers/staging/rtlwifi/rc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/rtlwifi/rc.c +1
-3@@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv,struct rtl_rate_priv *rate_priv; rate_priv =kzalloc (sizeof (*rate_priv), gfp); -if (!rate_priv) { -pr_err ("Unable to allocate private rc structure\n" ); +if (!rate_priv)return NULL ; - } rtlpriv->rate_priv = rate_priv;Signature · 1 line
2.7.4
After you format your patch , open it in vim and try running this command :%s/\s\+$//e
This removes trailing whitespaces , this might work for you . It works for me .
Regards,
Srishti
Quoted 39 lines · Srishti Sharma
On Sunday, September 10, 2017 at 12:25:54 AM UTC+5:30, Shreeya Patel wrote:
This patch removes unnecessary 'out of memory' message to make the code more efficient.
Problem found by checkpatch.
Signed-off-by Shreeya Patel <[email protected] <javascript:>>---
Changes in v2:
-Add a tab before the return statement.
drivers/staging/rtlwifi/rc.c| 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)diff --git
a/drivers/staging/rtlwifi/rc.cb/drivers/staging/rtlwifi/rc.c
index 65de0c7..779a5c6 100644
---a/drivers/staging/rtlwifi/rc.c
+++b/drivers/staging/rtlwifi/rc.c
@@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv,
structrtl_rate_priv*rate_priv;
rate_priv=kzalloc(sizeof(*rate_priv), gfp);
- if (!rate_priv) {
-pr_err("Unable to allocate private rc structure\n");
+ if (!rate_priv)
return NULL;
- }
rtlpriv->rate_priv=rate_priv;--
2.7.4
Quoted 5 lines
After you format your patch , open it in vim and try running this command :%s/\s\+$//e This removes trailing whitespaces , this might work for you . It works for me .
Regards,
Srishti
Sure, I will try this.
Thanks.
Quoted 6 lines
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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/7469455c-545c-4b30-af5b-5c54fc343c90%40googlegroups.com <https://groups.google.com/d/msgid/outreachy-kernel/7469455c-545c-4b30-af5b-5c54fc343c90%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout.
Quoted 38 lines · Srishti Sharma
On Sunday, September 10, 2017 at 12:25:54 AM UTC+5:30, Shreeya Patel wrote:
This patch removes unnecessary 'out of memory' message to make the code more efficient. Problem found by checkpatch. Signed-off-by: Shreeya Patel <[email protected]> --- Changes in v2: � -Add a tab before the return statement. �drivers/staging/rtlwifi/rc.c | 4 +--- �1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtlwifi/rc.c b/drivers/staging/rtlwifi/rc.c index 65de0c7..779a5c6 100644 --- a/drivers/staging/rtlwifi/rc.c +++ b/drivers/staging/rtlwifi/rc.c @@ -281,10 +281,8 @@ static void *rtl_rate_alloc_sta(void *ppriv, ���������struct rtl_rate_priv *rate_priv; � ���������rate_priv = kzalloc(sizeof(*rate_priv), gfp); -��������if (!rate_priv) { -����������������pr_err("Unable to allocate private rc structure\n"); +��������if (!rate_priv) �����������������return NULL; -��������} � ���������rtlpriv->rate_priv = rate_priv; � -- 2.7.4
Quoted 4 lines
After you format your patch , open it in vim and try running this command :%s/\
s\+$//e �
This removes trailing whitespaces , this might work for you . It works for me .�
Oh no, never do that. A patch file needs trailing spaces, that's part of the syntax of a patch file. If you don't have them, the patch will not apply properly.
Never edit a patch file "by hand" unless you really really really know what you are doing.
thanks,
greg k-h