Commit ebc6a533 authored by Dan Carpenter's avatar Dan Carpenter Committed by Kalle Valo

ath6kl: list_first_entry() is never NULL

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 2023dbb8
...@@ -108,8 +108,6 @@ static void get_htc_packet_credit_based(struct htc_target *target, ...@@ -108,8 +108,6 @@ static void get_htc_packet_credit_based(struct htc_target *target,
/* get packet at head, but don't remove it */ /* get packet at head, but don't remove it */
packet = list_first_entry(&ep->txq, struct htc_packet, list); packet = list_first_entry(&ep->txq, struct htc_packet, list);
if (packet == NULL)
break;
ath6kl_dbg(ATH6KL_DBG_HTC, ath6kl_dbg(ATH6KL_DBG_HTC,
"%s: got head packet:0x%p , queue depth: %d\n", "%s: got head packet:0x%p , queue depth: %d\n",
...@@ -803,8 +801,6 @@ static int htc_send_packets_multiple(struct htc_target *target, ...@@ -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 */ /* get first packet to find out which ep the packets will go into */
packet = list_first_entry(pkt_queue, struct htc_packet, list); packet = list_first_entry(pkt_queue, struct htc_packet, list);
if (packet == NULL)
return -EINVAL;
if (packet->endpoint >= ENDPOINT_MAX) { if (packet->endpoint >= ENDPOINT_MAX) {
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
...@@ -1636,10 +1632,6 @@ static int ath6kl_htc_pipe_add_rxbuf_multiple(struct htc_target *target, ...@@ -1636,10 +1632,6 @@ static int ath6kl_htc_pipe_add_rxbuf_multiple(struct htc_target *target,
return -EINVAL; return -EINVAL;
first = list_first_entry(pkt_queue, struct htc_packet, list); first = list_first_entry(pkt_queue, struct htc_packet, list);
if (first == NULL) {
WARN_ON_ONCE(1);
return -EINVAL;
}
if (first->endpoint >= ENDPOINT_MAX) { if (first->endpoint >= ENDPOINT_MAX) {
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
......
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