All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivani Bhardwaj <shivanib134@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 3/3] Staging: wilc1000: host_interface: Remove unused code
Date: Mon, 12 Oct 2015 19:51:48 +0530	[thread overview]
Message-ID: <CAKHNQQGJM7VqEQnwgPjKBqQQGf8ukrB4_JX=t21F5phcf3NnAw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1510121542430.2652@hadrien>

On Mon, Oct 12, 2015 at 7:24 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Mon, 12 Oct 2015, Shivani Bhardwaj wrote:
>
>> Remove declaration and initialization of variables that are not used
>> anywhere in the code.
>> Issue found using coccinelle.
>>
>> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
>> ---
>>  drivers/staging/wilc1000/host_interface.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
>> index b6eea9a..9e8bbc1 100644
>> --- a/drivers/staging/wilc1000/host_interface.c
>> +++ b/drivers/staging/wilc1000/host_interface.c
>> @@ -4894,7 +4894,6 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid,
>>       s32 s32Error = 0;
>>       tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
>>       struct host_if_msg msg;
>> -     tenuScanConnTimer enuScanConnTimer;
>
> Got grep shows me only three uses of "tenuScanConnTimer".  One is the
> typedef, and the other two are removed by your patch.  So you could redo
> the patch and get rid of the typedef as well.
>
> Looking a bit more at the code, I see the following, which looks strange:
>
> tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
>
> As far as I can tell, hWFIDrv already has type tstrWILC_WFIDrv, so the
> cast is not necessary.  And it seems strange to have the two tests, first
>
> if (pstrWFIDrv == NULL || pfConnectResult == NULL)
>
> and then
>
> if (hWFIDrv == NULL)
>
> because the second one tests a subset of what the first one tests.
>
> Greg would also say that we don't need the type names embedded in the
> variable names either, but that would be a lot to change, especially since
> it impacts the field names too.
>
> In Coccinelle, you can make an expression metavariable that matches
> expressions of a particular type.  So
>
> @@
> type T;
> T e;
> identifier x;
> @@
>
> * T x = (T)e;
>
> will highlight initializations with useless casts.
>
> julia
>

Thanks so much, Julia. I'm applying all of this. Thank you for the
coccinelle script. Also, I want to know that I've been notified about
one of the patch of this series that it was sent before and has not
been applied. So, should I send an entirely new patch series removing
that one or even parts of the series can be applied to the tree?

>>
>>       if (pstrWFIDrv == NULL || pfConnectResult == NULL) {
>>               s32Error = -EFAULT;
>> @@ -4957,7 +4956,6 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid,
>>               return -EFAULT;
>>       }
>>
>> -     enuScanConnTimer = CONNECT_TIMER;
>>       pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv;
>>       mod_timer(&pstrWFIDrv->hConnectTimer,
>>                 jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT));
>> @@ -5560,7 +5558,6 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource,
>>       s32 s32Error = 0;
>>       tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
>>       struct host_if_msg msg;
>> -     tenuScanConnTimer enuScanConnTimer;
>>
>>       if (pstrWFIDrv == NULL || ScanResult == NULL) {
>>               PRINT_ER("pstrWFIDrv or ScanResult = NULL\n");
>> @@ -5602,7 +5599,6 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource,
>>               return -EINVAL;
>>       }
>>
>> -     enuScanConnTimer = SCAN_TIMER;
>>       PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n");
>>       pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv;
>>       mod_timer(&pstrWFIDrv->hScanTimer,
>> --
>> 2.1.0
>>
>> --
>> 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 outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d8f8cff7018b0c9905df40eaa754b53e8164324e.1444655924.git.shivanib134%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>


  reply	other threads:[~2015-10-12 14:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 13:34 [PATCH 0/3] Fix issues detected by coccinelle Shivani Bhardwaj
2015-10-12 13:35 ` [PATCH 1/3] Staging: wilc1000: host_interface: Replace kmalloc with kzalloc Shivani Bhardwaj
2015-10-12 13:45   ` [Outreachy kernel] " Shraddha Barke
2015-10-12 13:35 ` [PATCH 2/3] Staging: wilc1000: host_interface: Remove extra NULL test Shivani Bhardwaj
2015-10-12 15:42   ` [Outreachy kernel] " Shraddha Barke
2015-10-12 15:48     ` Shivani Bhardwaj
2015-10-12 13:36 ` [PATCH 3/3] Staging: wilc1000: host_interface: Remove unused code Shivani Bhardwaj
2015-10-12 13:54   ` [Outreachy kernel] " Julia Lawall
2015-10-12 14:21     ` Shivani Bhardwaj [this message]
2015-10-12 14:27       ` Julia Lawall
2015-10-12 15:24         ` Shivani Bhardwaj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKHNQQGJM7VqEQnwgPjKBqQQGf8ukrB4_JX=t21F5phcf3NnAw@mail.gmail.com' \
    --to=shivanib134@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.