Commit a00979cc authored by Devendra Naga's avatar Devendra Naga Committed by Greg Kroah-Hartman

staging: sbe-2t3e3: use -ve error return codes in dc_init_descriptor_list

the dc_init_descriptor_list actually returns a +ve error return codes,
which is abnormal as other functions in kernel return -ve error codes on
failure. so replace the return codes of this function with -ve values
to make the consistency with the other functions in kernel.

Also make the dc_init_descriptor_list static as its never called
anywhere except in this file and move the function prototype from the
headerfile into the c file as its referred only in this c file.
Signed-off-by: default avatarDevendra Naga <devendra.aaru@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bae95b09
...@@ -789,7 +789,6 @@ void dc_restart(struct channel *); ...@@ -789,7 +789,6 @@ void dc_restart(struct channel *);
void dc_receiver_onoff(struct channel *, u32); void dc_receiver_onoff(struct channel *, u32);
void dc_transmitter_onoff(struct channel *, u32); void dc_transmitter_onoff(struct channel *, u32);
void dc_set_loopback(struct channel *, u32); void dc_set_loopback(struct channel *, u32);
u32 dc_init_descriptor_list(struct channel *);
void dc_clear_descriptor_list(struct channel *); void dc_clear_descriptor_list(struct channel *);
void dc_drop_descriptor_list(struct channel *); void dc_drop_descriptor_list(struct channel *);
void dc_set_output_port(struct channel *); void dc_set_output_port(struct channel *);
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "2t3e3.h" #include "2t3e3.h"
#include "ctrl.h" #include "ctrl.h"
static int dc_init_descriptor_list(struct channel *sc);
void dc_init(struct channel *sc) void dc_init(struct channel *sc)
{ {
u32 val; u32 val;
...@@ -307,7 +309,7 @@ void dc_set_loopback(struct channel *sc, u32 mode) ...@@ -307,7 +309,7 @@ void dc_set_loopback(struct channel *sc, u32 mode)
SBE_2T3E3_21143_VAL_FULL_DUPLEX_MODE); SBE_2T3E3_21143_VAL_FULL_DUPLEX_MODE);
} }
u32 dc_init_descriptor_list(struct channel *sc) static int dc_init_descriptor_list(struct channel *sc)
{ {
u32 i, j; u32 i, j;
struct sk_buff *m; struct sk_buff *m;
...@@ -317,7 +319,7 @@ u32 dc_init_descriptor_list(struct channel *sc) ...@@ -317,7 +319,7 @@ u32 dc_init_descriptor_list(struct channel *sc)
sizeof(t3e3_rx_desc_t), GFP_KERNEL); sizeof(t3e3_rx_desc_t), GFP_KERNEL);
if (sc->ether.rx_ring == NULL) { if (sc->ether.rx_ring == NULL) {
dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n"); dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n");
return ENOMEM; return -ENOMEM;
} }
if (sc->ether.tx_ring == NULL) if (sc->ether.tx_ring == NULL)
...@@ -327,7 +329,7 @@ u32 dc_init_descriptor_list(struct channel *sc) ...@@ -327,7 +329,7 @@ u32 dc_init_descriptor_list(struct channel *sc)
kfree(sc->ether.rx_ring); kfree(sc->ether.rx_ring);
sc->ether.rx_ring = NULL; sc->ether.rx_ring = NULL;
dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n"); dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n");
return ENOMEM; return -ENOMEM;
} }
...@@ -351,7 +353,7 @@ u32 dc_init_descriptor_list(struct channel *sc) ...@@ -351,7 +353,7 @@ u32 dc_init_descriptor_list(struct channel *sc)
sc->ether.tx_ring = NULL; sc->ether.tx_ring = NULL;
dev_err(&sc->pdev->dev, "SBE 2T3E3: token_alloc err:" dev_err(&sc->pdev->dev, "SBE 2T3E3: token_alloc err:"
" no buffer space for RX ring\n"); " no buffer space for RX ring\n");
return ENOBUFS; return -ENOBUFS;
} }
sc->ether.rx_data[i] = m; sc->ether.rx_data[i] = m;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment