mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
caif: Replace BUG_ON with WARN_ON.
BUG_ON is too strict in a number of circumstances, use WARN_ON instead. Protocol errors should not halt the system. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
095d2a71e5
commit
f84ea779c2
@ -933,7 +933,7 @@ static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
|
|
||||||
/* Create HSI frame. */
|
/* Create HSI frame. */
|
||||||
len = cfhsi_tx_frm(desc, cfhsi);
|
len = cfhsi_tx_frm(desc, cfhsi);
|
||||||
BUG_ON(!len);
|
WARN_ON(!len);
|
||||||
|
|
||||||
/* Set up new transfer. */
|
/* Set up new transfer. */
|
||||||
res = cfhsi->dev->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->dev);
|
res = cfhsi->dev->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->dev);
|
||||||
|
@ -261,7 +261,7 @@ static int handle_tx(struct ser_device *ser)
|
|||||||
skb_pull(skb, tty_wr);
|
skb_pull(skb, tty_wr);
|
||||||
if (skb->len == 0) {
|
if (skb->len == 0) {
|
||||||
struct sk_buff *tmp = skb_dequeue(&ser->head);
|
struct sk_buff *tmp = skb_dequeue(&ser->head);
|
||||||
BUG_ON(tmp != skb);
|
WARN_ON(tmp != skb);
|
||||||
if (in_interrupt())
|
if (in_interrupt())
|
||||||
dev_kfree_skb_irq(skb);
|
dev_kfree_skb_irq(skb);
|
||||||
else
|
else
|
||||||
@ -305,7 +305,7 @@ static void ldisc_tx_wakeup(struct tty_struct *tty)
|
|||||||
|
|
||||||
ser = tty->disc_data;
|
ser = tty->disc_data;
|
||||||
BUG_ON(ser == NULL);
|
BUG_ON(ser == NULL);
|
||||||
BUG_ON(ser->tty != tty);
|
WARN_ON(ser->tty != tty);
|
||||||
handle_tx(ser);
|
handle_tx(ser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,11 @@ static void shm_rx_work_func(struct work_struct *rx_work)
|
|||||||
/* Get a suitable CAIF packet and copy in data. */
|
/* Get a suitable CAIF packet and copy in data. */
|
||||||
skb = netdev_alloc_skb(pshm_drv->pshm_dev->pshm_netdev,
|
skb = netdev_alloc_skb(pshm_drv->pshm_dev->pshm_netdev,
|
||||||
frm_pck_len + 1);
|
frm_pck_len + 1);
|
||||||
BUG_ON(skb == NULL);
|
|
||||||
|
if (skb == NULL) {
|
||||||
|
pr_info("OOM: Try next frame in descriptor\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
p = skb_put(skb, frm_pck_len);
|
p = skb_put(skb, frm_pck_len);
|
||||||
memcpy(p, pbuf->desc_vptr + frm_pck_ofs, frm_pck_len);
|
memcpy(p, pbuf->desc_vptr + frm_pck_ofs, frm_pck_len);
|
||||||
|
@ -58,7 +58,6 @@ static int q_high = 50; /* Percent */
|
|||||||
struct cfcnfg *get_cfcnfg(struct net *net)
|
struct cfcnfg *get_cfcnfg(struct net *net)
|
||||||
{
|
{
|
||||||
struct caif_net *caifn;
|
struct caif_net *caifn;
|
||||||
BUG_ON(!net);
|
|
||||||
caifn = net_generic(net, caif_net_id);
|
caifn = net_generic(net, caif_net_id);
|
||||||
if (!caifn)
|
if (!caifn)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -69,7 +68,6 @@ EXPORT_SYMBOL(get_cfcnfg);
|
|||||||
static struct caif_device_entry_list *caif_device_list(struct net *net)
|
static struct caif_device_entry_list *caif_device_list(struct net *net)
|
||||||
{
|
{
|
||||||
struct caif_net *caifn;
|
struct caif_net *caifn;
|
||||||
BUG_ON(!net);
|
|
||||||
caifn = net_generic(net, caif_net_id);
|
caifn = net_generic(net, caif_net_id);
|
||||||
if (!caifn)
|
if (!caifn)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -507,15 +505,15 @@ static struct notifier_block caif_device_notifier = {
|
|||||||
static int caif_init_net(struct net *net)
|
static int caif_init_net(struct net *net)
|
||||||
{
|
{
|
||||||
struct caif_net *caifn = net_generic(net, caif_net_id);
|
struct caif_net *caifn = net_generic(net, caif_net_id);
|
||||||
BUG_ON(!caifn);
|
if (WARN_ON(!caifn))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&caifn->caifdevs.list);
|
INIT_LIST_HEAD(&caifn->caifdevs.list);
|
||||||
mutex_init(&caifn->caifdevs.lock);
|
mutex_init(&caifn->caifdevs.lock);
|
||||||
|
|
||||||
caifn->cfg = cfcnfg_create();
|
caifn->cfg = cfcnfg_create();
|
||||||
if (!caifn->cfg) {
|
if (!caifn->cfg)
|
||||||
pr_warn("can't create cfcnfg\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user