* [PATCH] staging: slicoss: remove unused variables
@ 2015-09-04 13:23 Sudip Mukherjee
2015-09-04 18:13 ` David Matlack
2015-09-09 18:31 ` Greg Kroah-Hartman
0 siblings, 2 replies; 6+ messages in thread
From: Sudip Mukherjee @ 2015-09-04 13:23 UTC (permalink / raw)
To: Lior Dotan, Christopher Harrer, Greg Kroah-Hartman
Cc: linux-kernel, devel, Sudip Mukherjee
These variables were only assigned some values but they were never used.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/staging/slicoss/slicoss.c | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 8585970..1536ca0 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -199,10 +199,8 @@ static void slic_mcast_set_mask(struct adapter *adapter)
static void slic_timer_ping(ulong dev)
{
struct adapter *adapter;
- struct sliccard *card;
adapter = netdev_priv((struct net_device *)dev);
- card = adapter->card;
adapter->pingtimer.expires = jiffies + (PING_TIMER_INTERVAL * HZ);
add_timer(&adapter->pingtimer);
@@ -1719,7 +1717,6 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb)
*/
static void slic_link_event_handler(struct adapter *adapter)
{
- int status;
struct slic_shmem *pshmem;
if (adapter->state != ADAPT_UP) {
@@ -1730,15 +1727,13 @@ static void slic_link_event_handler(struct adapter *adapter)
pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem;
#if BITS_PER_LONG == 64
- status = slic_upr_request(adapter,
- SLIC_UPR_RLSR,
- SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
- SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
- 0, 0);
+ slic_upr_request(adapter, SLIC_UPR_RLSR,
+ SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
+ SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), 0, 0);
#else
- status = slic_upr_request(adapter, SLIC_UPR_RLSR,
- (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */
- 0, 0, 0);
+ slic_upr_request(adapter, SLIC_UPR_RLSR,
+ (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */
+ 0, 0, 0);
#endif
}
@@ -2078,8 +2073,6 @@ static void slic_interrupt_card_up(u32 isr, struct adapter *adapter,
adapter->error_interrupts++;
if (isr & ISR_RMISS) {
int count;
- int pre_count;
- int errors;
struct slic_rcvqueue *rcvq =
&adapter->rcvqueue;
@@ -2088,8 +2081,6 @@ static void slic_interrupt_card_up(u32 isr, struct adapter *adapter,
if (!rcvq->errors)
rcv_count = rcvq->count;
- pre_count = rcvq->count;
- errors = rcvq->errors;
while (rcvq->count < SLIC_RCVQ_FILLTHRESH) {
count = slic_rcvqueue_fill(adapter);
@@ -2650,9 +2641,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
ushort calc_chksum;
struct slic_config_mac *pmac;
unsigned char fruformat;
- unsigned char oemfruformat;
struct atk_fru *patkfru;
- union oemfru *poemfru;
unsigned long flags;
/* Reset everything except PCI configuration space */
@@ -2742,8 +2731,6 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
pmac = pOeeprom->MacInfo;
fruformat = pOeeprom->FruFormat;
patkfru = &pOeeprom->AtkFru;
- oemfruformat = pOeeprom->OemFruFormat;
- poemfru = &pOeeprom->OemFru;
macaddrs = 2;
/* Minor kludge for Oasis card
get 2 MAC addresses from the
@@ -2757,8 +2744,6 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
pmac = peeprom->u2.mac.MacInfo;
fruformat = peeprom->FruFormat;
patkfru = &peeprom->AtkFru;
- oemfruformat = peeprom->OemFruFormat;
- poemfru = &peeprom->OemFru;
break;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: slicoss: remove unused variables
2015-09-04 13:23 [PATCH] staging: slicoss: remove unused variables Sudip Mukherjee
@ 2015-09-04 18:13 ` David Matlack
2015-09-05 8:08 ` Sudip Mukherjee
2015-09-09 18:31 ` Greg Kroah-Hartman
1 sibling, 1 reply; 6+ messages in thread
From: David Matlack @ 2015-09-04 18:13 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Lior Dotan, Christopher Harrer, Greg Kroah-Hartman,
linux-kernel@vger.kernel.org, devel
On Fri, Sep 4, 2015 at 6:23 AM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> These variables were only assigned some values but they were never used.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/staging/slicoss/slicoss.c | 27 ++++++---------------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> index 8585970..1536ca0 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -199,10 +199,8 @@ static void slic_mcast_set_mask(struct adapter *adapter)
> static void slic_timer_ping(ulong dev)
> {
> struct adapter *adapter;
> - struct sliccard *card;
>
> adapter = netdev_priv((struct net_device *)dev);
> - card = adapter->card;
>
> adapter->pingtimer.expires = jiffies + (PING_TIMER_INTERVAL * HZ);
> add_timer(&adapter->pingtimer);
> @@ -1719,7 +1717,6 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb)
> */
> static void slic_link_event_handler(struct adapter *adapter)
> {
> - int status;
> struct slic_shmem *pshmem;
>
> if (adapter->state != ADAPT_UP) {
> @@ -1730,15 +1727,13 @@ static void slic_link_event_handler(struct adapter *adapter)
> pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem;
>
> #if BITS_PER_LONG == 64
> - status = slic_upr_request(adapter,
> - SLIC_UPR_RLSR,
> - SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> - SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
> - 0, 0);
> + slic_upr_request(adapter, SLIC_UPR_RLSR,
> + SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> + SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), 0, 0);
> #else
> - status = slic_upr_request(adapter, SLIC_UPR_RLSR,
> - (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */
> - 0, 0, 0);
> + slic_upr_request(adapter, SLIC_UPR_RLSR,
> + (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */
> + 0, 0, 0);
Is status safe to ignore?
> #endif
> }
>
> @@ -2078,8 +2073,6 @@ static void slic_interrupt_card_up(u32 isr, struct adapter *adapter,
> adapter->error_interrupts++;
> if (isr & ISR_RMISS) {
> int count;
> - int pre_count;
> - int errors;
>
> struct slic_rcvqueue *rcvq =
> &adapter->rcvqueue;
> @@ -2088,8 +2081,6 @@ static void slic_interrupt_card_up(u32 isr, struct adapter *adapter,
>
> if (!rcvq->errors)
> rcv_count = rcvq->count;
> - pre_count = rcvq->count;
> - errors = rcvq->errors;
>
> while (rcvq->count < SLIC_RCVQ_FILLTHRESH) {
> count = slic_rcvqueue_fill(adapter);
> @@ -2650,9 +2641,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
> ushort calc_chksum;
> struct slic_config_mac *pmac;
> unsigned char fruformat;
> - unsigned char oemfruformat;
> struct atk_fru *patkfru;
> - union oemfru *poemfru;
> unsigned long flags;
>
> /* Reset everything except PCI configuration space */
> @@ -2742,8 +2731,6 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
> pmac = pOeeprom->MacInfo;
> fruformat = pOeeprom->FruFormat;
> patkfru = &pOeeprom->AtkFru;
> - oemfruformat = pOeeprom->OemFruFormat;
> - poemfru = &pOeeprom->OemFru;
> macaddrs = 2;
> /* Minor kludge for Oasis card
> get 2 MAC addresses from the
> @@ -2757,8 +2744,6 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
> pmac = peeprom->u2.mac.MacInfo;
> fruformat = peeprom->FruFormat;
> patkfru = &peeprom->AtkFru;
> - oemfruformat = peeprom->OemFruFormat;
> - poemfru = &peeprom->OemFru;
> break;
> }
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: slicoss: remove unused variables
2015-09-04 18:13 ` David Matlack
@ 2015-09-05 8:08 ` Sudip Mukherjee
0 siblings, 0 replies; 6+ messages in thread
From: Sudip Mukherjee @ 2015-09-05 8:08 UTC (permalink / raw)
To: David Matlack
Cc: Lior Dotan, Christopher Harrer, Greg Kroah-Hartman,
linux-kernel@vger.kernel.org, devel
On Fri, Sep 04, 2015 at 11:13:00AM -0700, David Matlack wrote:
> On Fri, Sep 4, 2015 at 6:23 AM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > These variables were only assigned some values but they were never used.
> >
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
<snip>
> > - status = slic_upr_request(adapter, SLIC_UPR_RLSR,
> > - (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */
> > - 0, 0, 0);
> > + slic_upr_request(adapter, SLIC_UPR_RLSR,
> > + (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */
> > + 0, 0, 0);
>
> Is status safe to ignore?
status can have two value either -ENOMEM or STATUS_PEMDING.
Ideally we should have handled -ENOMEM.
regards
sudip
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: slicoss: remove unused variables
2015-09-04 13:23 [PATCH] staging: slicoss: remove unused variables Sudip Mukherjee
2015-09-04 18:13 ` David Matlack
@ 2015-09-09 18:31 ` Greg Kroah-Hartman
2015-09-10 13:22 ` Sudip Mukherjee
1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-09 18:31 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Lior Dotan, Christopher Harrer, devel, linux-kernel
On Fri, Sep 04, 2015 at 06:53:18PM +0530, Sudip Mukherjee wrote:
> These variables were only assigned some values but they were never used.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/staging/slicoss/slicoss.c | 27 ++++++---------------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> index 8585970..1536ca0 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -199,10 +199,8 @@ static void slic_mcast_set_mask(struct adapter *adapter)
> static void slic_timer_ping(ulong dev)
> {
> struct adapter *adapter;
> - struct sliccard *card;
>
> adapter = netdev_priv((struct net_device *)dev);
> - card = adapter->card;
>
> adapter->pingtimer.expires = jiffies + (PING_TIMER_INTERVAL * HZ);
> add_timer(&adapter->pingtimer);
> @@ -1719,7 +1717,6 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb)
> */
> static void slic_link_event_handler(struct adapter *adapter)
> {
> - int status;
> struct slic_shmem *pshmem;
>
> if (adapter->state != ADAPT_UP) {
> @@ -1730,15 +1727,13 @@ static void slic_link_event_handler(struct adapter *adapter)
> pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem;
>
> #if BITS_PER_LONG == 64
> - status = slic_upr_request(adapter,
> - SLIC_UPR_RLSR,
> - SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> - SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
> - 0, 0);
> + slic_upr_request(adapter, SLIC_UPR_RLSR,
> + SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> + SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), 0, 0);
> #else
> - status = slic_upr_request(adapter, SLIC_UPR_RLSR,
> - (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */
> - 0, 0, 0);
> + slic_upr_request(adapter, SLIC_UPR_RLSR,
> + (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */
> + 0, 0, 0);
Shouldn't we do something with status instead of just ignoring it?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: slicoss: remove unused variables
2015-09-09 18:31 ` Greg Kroah-Hartman
@ 2015-09-10 13:22 ` Sudip Mukherjee
2015-09-12 2:51 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2015-09-10 13:22 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Lior Dotan, Christopher Harrer, devel, linux-kernel
On Wed, Sep 09, 2015 at 11:31:37AM -0700, Greg Kroah-Hartman wrote:
> On Fri, Sep 04, 2015 at 06:53:18PM +0530, Sudip Mukherjee wrote:
> > These variables were only assigned some values but they were never used.
> >
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> > drivers/staging/slicoss/slicoss.c | 27 ++++++---------------------
> > 1 file changed, 6 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> > index 8585970..1536ca0 100644
> > --- a/drivers/staging/slicoss/slicoss.c
> > +++ b/drivers/staging/slicoss/slicoss.c
<snip>
> > @@ -1730,15 +1727,13 @@ static void slic_link_event_handler(struct adapter *adapter)
> > pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem;
> >
> > #if BITS_PER_LONG == 64
> > - status = slic_upr_request(adapter,
> > - SLIC_UPR_RLSR,
> > - SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> > - SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
> > - 0, 0);
> > + slic_upr_request(adapter, SLIC_UPR_RLSR,
> > + SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> > + SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), 0, 0);
> > #else
> > - status = slic_upr_request(adapter, SLIC_UPR_RLSR,
> > - (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */
> > - 0, 0, 0);
> > + slic_upr_request(adapter, SLIC_UPR_RLSR,
> > + (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */
> > + 0, 0, 0);
>
> Shouldn't we do something with status instead of just ignoring it?
I can think of 3 possibilities.
1) Ignore it as this is writing READ_LINK_STATUS command to the device
asynchronously, and then writing UP configuration command. So if status
is error here then the device will not be UP.
2) loop here with a delay until the call succeeds. (will be a very bad
design, but there are some codes doing that). But this functions is also
called from an ISR so we should not be doing that.
3) return the error code and do the error handling properly by clearing
and releasing all resources acquired by the function which called it.
Which one will you suggest? I am sure you will say : 3. :)
regards
sudip
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: slicoss: remove unused variables
2015-09-10 13:22 ` Sudip Mukherjee
@ 2015-09-12 2:51 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-12 2:51 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: devel, Christopher Harrer, Lior Dotan, linux-kernel
On Thu, Sep 10, 2015 at 06:52:22PM +0530, Sudip Mukherjee wrote:
> On Wed, Sep 09, 2015 at 11:31:37AM -0700, Greg Kroah-Hartman wrote:
> > On Fri, Sep 04, 2015 at 06:53:18PM +0530, Sudip Mukherjee wrote:
> > > These variables were only assigned some values but they were never used.
> > >
> > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > > ---
> > > drivers/staging/slicoss/slicoss.c | 27 ++++++---------------------
> > > 1 file changed, 6 insertions(+), 21 deletions(-)
> > >
> > > diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> > > index 8585970..1536ca0 100644
> > > --- a/drivers/staging/slicoss/slicoss.c
> > > +++ b/drivers/staging/slicoss/slicoss.c
> <snip>
> > > @@ -1730,15 +1727,13 @@ static void slic_link_event_handler(struct adapter *adapter)
> > > pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem;
> > >
> > > #if BITS_PER_LONG == 64
> > > - status = slic_upr_request(adapter,
> > > - SLIC_UPR_RLSR,
> > > - SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> > > - SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
> > > - 0, 0);
> > > + slic_upr_request(adapter, SLIC_UPR_RLSR,
> > > + SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
> > > + SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), 0, 0);
> > > #else
> > > - status = slic_upr_request(adapter, SLIC_UPR_RLSR,
> > > - (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */
> > > - 0, 0, 0);
> > > + slic_upr_request(adapter, SLIC_UPR_RLSR,
> > > + (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */
> > > + 0, 0, 0);
> >
> > Shouldn't we do something with status instead of just ignoring it?
> I can think of 3 possibilities.
> 1) Ignore it as this is writing READ_LINK_STATUS command to the device
> asynchronously, and then writing UP configuration command. So if status
> is error here then the device will not be UP.
>
> 2) loop here with a delay until the call succeeds. (will be a very bad
> design, but there are some codes doing that). But this functions is also
> called from an ISR so we should not be doing that.
>
> 3) return the error code and do the error handling properly by clearing
> and releasing all resources acquired by the function which called it.
>
> Which one will you suggest? I am sure you will say : 3. :)
I don't know why you even had to ask, of course 3 is the correct thing
:)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-12 4:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 13:23 [PATCH] staging: slicoss: remove unused variables Sudip Mukherjee
2015-09-04 18:13 ` David Matlack
2015-09-05 8:08 ` Sudip Mukherjee
2015-09-09 18:31 ` Greg Kroah-Hartman
2015-09-10 13:22 ` Sudip Mukherjee
2015-09-12 2:51 ` Greg Kroah-Hartman
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).