Skip to contentSkip to conversation

staging: most: dim2: remove BUG_ON() calls

PATCH In review Mark Adamenko 2 participants 2 messages Mar 10 – Mar 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: most: dim2: remove BUG_ON() calls

All BUG_ON() calls in this file are redundant either because of impossible conditions or prior error handling. Remove all BUG_ON() calls.

---
 drivers/staging/most/dim2/dim2.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/staging/most/dim2/dim2.c +0 -13
index 66617e89e028..c8fdc6a52467 100644
@@ -165,9 +165,6 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch)
 	unsigned long flags;
 	struct dim_ch_state st;
 
-	BUG_ON(!hdm_ch);
-	BUG_ON(!hdm_ch->is_initialized);
-
 	spin_lock_irqsave(&dim_lock, flags);
 	if (list_empty(head)) {
 		spin_unlock_irqrestore(&dim_lock, flags);
@@ -187,7 +184,6 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch)
 		return -EAGAIN;
 	}
 
-	BUG_ON(mbo->bus_address == 0);
 	if (!dim_enqueue_buffer(&hdm_ch->ch, mbo->bus_address, buf_size)) {
 		list_del(head->next);
 		spin_unlock_irqrestore(&dim_lock, flags);
@@ -268,9 +264,6 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx)
 	unsigned long flags;
 	u8 *data;
 
-	BUG_ON(!hdm_ch);
-	BUG_ON(!hdm_ch->is_initialized);
-
 	spin_lock_irqsave(&dim_lock, flags);
 
 	done_buffers = dim_get_channel_state(&hdm_ch->ch, &st)->done_buffers;
@@ -454,8 +447,6 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx,
 	int const ch_addr = ch_idx * 2 + 2;
 	struct hdm_channel *const hdm_ch = dev->hch + ch_idx;
 
-	BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
-
 	if (hdm_ch->is_initialized)
 		return -EPERM;
 
@@ -566,8 +557,6 @@ static int enqueue(struct most_interface *most_iface, int ch_idx,
 	struct hdm_channel *hdm_ch = dev->hch + ch_idx;
 	unsigned long flags;
 
-	BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
-
 	if (!hdm_ch->is_initialized)
 		return -EPERM;
 
@@ -642,8 +631,6 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
 	u8 hal_ret;
 	int ret = 0;
 
-	BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
-
 	if (!hdm_ch->is_initialized)
 		return -EPERM;
 
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 14 lines · Mark Adamenko

All BUG_ON() calls in this file are redundant either because of impossible conditions or prior error handling. Remove all BUG_ON() calls.

---
 drivers/staging/most/dim2/dim2.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/staging/most/dim2/dim2.c +0 -0
index 66617e89e028..c8fdc6a52467 100644

drivers/staging/most/dim2/dim2.c static int try_start_dim_transfer(struct hdm_channel *hdm_ch) · line 170

Quoted 6 lines
drivers/staging/most/dim2/dim2.c +0 -3
@@ -165,9 +165,6 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch)
 	unsigned long flags;
 	struct dim_ch_state st;
 
-	BUG_ON(!hdm_ch);
-	BUG_ON(!hdm_ch->is_initialized);
-

Please only remove one at a time, and provide the "proof" in the changelog for why the case can never be hit.

thanks,

greg k-h