* [patch] ath6kl: list_first_entry() is never NULL
@ 2012-04-13 19:27 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-04-13 19:27 UTC (permalink / raw)
To: Kalle Valo; +Cc: John W. Linville, linux-wireless, kernel-janitors
We can remove the NULL check here. It triggers a Smatch warning because
list_first_entry() never is NULL and people who check for it normally
intend to check for list_empty() instead. In these cases however,
we've already verified that the lists are not empty.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
index b277b34..b21a69f 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
@@ -108,8 +108,6 @@ static void get_htc_packet_credit_based(struct htc_target *target,
/* get packet at head, but don't remove it */
packet = list_first_entry(&ep->txq, struct htc_packet, list);
- if (packet == NULL)
- break;
ath6kl_dbg(ATH6KL_DBG_HTC,
"%s: got head packet:0x%p , queue depth: %d\n",
@@ -803,8 +801,6 @@ static int htc_send_packets_multiple(struct htc_target *target,
/* get first packet to find out which ep the packets will go into */
packet = list_first_entry(pkt_queue, struct htc_packet, list);
- if (packet == NULL)
- return -EINVAL;
if (packet->endpoint >= ENDPOINT_MAX) {
WARN_ON_ONCE(1);
@@ -1636,10 +1632,6 @@ static int ath6kl_htc_pipe_add_rxbuf_multiple(struct htc_target *target,
return -EINVAL;
first = list_first_entry(pkt_queue, struct htc_packet, list);
- if (first == NULL) {
- WARN_ON_ONCE(1);
- return -EINVAL;
- }
if (first->endpoint >= ENDPOINT_MAX) {
WARN_ON_ONCE(1);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch] ath6kl: list_first_entry() is never NULL
@ 2012-04-13 19:27 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-04-13 19:27 UTC (permalink / raw)
To: Kalle Valo; +Cc: John W. Linville, linux-wireless, kernel-janitors
We can remove the NULL check here. It triggers a Smatch warning because
list_first_entry() never is NULL and people who check for it normally
intend to check for list_empty() instead. In these cases however,
we've already verified that the lists are not empty.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
index b277b34..b21a69f 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
@@ -108,8 +108,6 @@ static void get_htc_packet_credit_based(struct htc_target *target,
/* get packet at head, but don't remove it */
packet = list_first_entry(&ep->txq, struct htc_packet, list);
- if (packet = NULL)
- break;
ath6kl_dbg(ATH6KL_DBG_HTC,
"%s: got head packet:0x%p , queue depth: %d\n",
@@ -803,8 +801,6 @@ static int htc_send_packets_multiple(struct htc_target *target,
/* get first packet to find out which ep the packets will go into */
packet = list_first_entry(pkt_queue, struct htc_packet, list);
- if (packet = NULL)
- return -EINVAL;
if (packet->endpoint >= ENDPOINT_MAX) {
WARN_ON_ONCE(1);
@@ -1636,10 +1632,6 @@ static int ath6kl_htc_pipe_add_rxbuf_multiple(struct htc_target *target,
return -EINVAL;
first = list_first_entry(pkt_queue, struct htc_packet, list);
- if (first = NULL) {
- WARN_ON_ONCE(1);
- return -EINVAL;
- }
if (first->endpoint >= ENDPOINT_MAX) {
WARN_ON_ONCE(1);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] ath6kl: list_first_entry() is never NULL
2012-04-13 19:27 ` Dan Carpenter
@ 2012-04-16 6:27 ` Kalle Valo
-1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2012-04-16 6:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: John W. Linville, linux-wireless, kernel-janitors, ath6kl-devel
On 04/13/2012 10:27 PM, Dan Carpenter wrote:
> We can remove the NULL check here. It triggers a Smatch warning because
> list_first_entry() never is NULL and people who check for it normally
> intend to check for list_empty() instead. In these cases however,
> we've already verified that the lists are not empty.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, applied to ath6kl.git.
Kalle
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] ath6kl: list_first_entry() is never NULL
@ 2012-04-16 6:27 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2012-04-16 6:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: John W. Linville, linux-wireless, kernel-janitors, ath6kl-devel
On 04/13/2012 10:27 PM, Dan Carpenter wrote:
> We can remove the NULL check here. It triggers a Smatch warning because
> list_first_entry() never is NULL and people who check for it normally
> intend to check for list_empty() instead. In these cases however,
> we've already verified that the lists are not empty.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, applied to ath6kl.git.
Kalle
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-16 6:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 19:27 [patch] ath6kl: list_first_entry() is never NULL Dan Carpenter
2012-04-13 19:27 ` Dan Carpenter
2012-04-16 6:27 ` Kalle Valo
2012-04-16 6:27 ` Kalle Valo
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.