Skip to contentSkip to conversation

BUG_ON conversion for drivers/media/video/pwc/pwc-if.c

PATCH New Eric Sesterhenn 1 participant 4 messages Sep 18, 2006

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

PATCH 1/1 BUG_ON conversion for drivers/media/video/pwc/pwc-if.c

hi,

this patch converts a if () BUG(); construct to BUG_ON(); which occupies less space, uses unlikely and is safer when BUG() is disabled.

drivers/media/video/pwc/pwc-if.c renamed from drivers/media/video/pwc/pwc-if.c.orig +1 -2
@@ -1082,8 +1082,7 @@ static int pwc_video_open(struct inode *
 	PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev);
 
 	pdev = (struct pwc_device *)vdev->priv;
-	if (pdev = NULL)
-		BUG();
+	BUG_ON(!pdev);
 	if (pdev->vopen) {
 		PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n");
 		return -EBUSY;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

PATCH 1/1 BUG_ON conversion for drivers/mmc/omap.c

hi,

this patch converts a if () BUG(); construct to BUG_ON(); which occupies less space, uses unlikely and is safer when BUG() is disabled.

drivers/mmc/omap.c renamed from drivers/mmc/omap.c.orig +1 -2
@@ -640,8 +640,7 @@ mmc_omap_prepare_dma(struct mmc_omap_hos
 	}
 
 	/* Max limit for DMA frame count is 0xffff */
-	if (unlikely(count > 0xffff))
-		BUG();
+	BUG_ON(count > 0xffff);
 
 	OMAP_MMC_WRITE(host->base, BUF, buf);
 	omap_set_dma_transfer_params(dma_ch, OMAP_DMA_DATA_TYPE_S16,

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

PATCH 1/1 BUG_ON conversion for drivers/s390/

In reply to Eric Sesterhenn

hi,

this patch converts several if () BUG(); construct to BUG_ON(); which occupies less space, uses unlikely and is safer when BUG() is disabled.

drivers/s390/char/tape_3590.c renamed from drivers/s390/char/tape_3590.c.orig +1 -2
@@ -323,8 +323,7 @@ tape_3590_bread(struct tape_device *devi
 				ccw++;
 				dst += TAPEBLOCK_HSEC_SIZE;
 			}
-			if (off > bv->bv_len)
-				BUG();
+			BUG_ON(off > bv->bv_len);
 		}
 	}
 	ccw = tape_ccw_end(ccw, NOP, 0, NULL);
drivers/s390/char/tape_core.c renamed from drivers/s390/char/tape_core.c.orig +1 -2
@@ -651,8 +651,7 @@ tape_alloc_request(int cplength, int dat
 {
 	struct tape_request *request;
 
-	if (datasize > PAGE_SIZE || (cplength*sizeof(struct ccw1)) > PAGE_SIZE)
-		BUG();
+	BUG_ON(datasize > PAGE_SIZE || (cplength*sizeof(struct ccw1)) > PAGE_SIZE);
 
 	DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize);
 
drivers/s390/char/tape_std.c renamed from drivers/s390/char/tape_std.c.orig +1 -2
@@ -39,8 +39,7 @@ tape_std_assign_timeout(unsigned long da
 	int rc;
 
 	request = (struct tape_request *) data;
-	if ((device = request->device) = NULL)
-		BUG();
+	BUG_ON((device = request->device) = NULL);
 
 	DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
 			device->cdev_id);
drivers/s390/net/lcs.c renamed from drivers/s390/net/lcs.c.orig +1 -2
@@ -696,8 +696,7 @@ __lcs_processed_buffer(struct lcs_channe
 	int index, prev, next;
 
 	LCS_DBF_TEXT(5, trace, "prcsbuff");
-	if (buffer->state != BUF_STATE_READY)
-		BUG();
+	BUG_ON(buffer->state != BUF_STATE_READY);
 	buffer->state = BUF_STATE_PROCESSED;
 	index = buffer - channel->iob;
 	prev = (index - 1) & (LCS_NUM_BUFFS - 1);

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

PATCH 1/1 BUG_ON conversion for drivers/usb/input/wacom.c

In reply to Eric Sesterhenn

hi,

this patch converts two if () BUG(); construct to BUG_ON(); which occupies less space, uses unlikely and is safer when BUG() is disabled.

drivers/usb/input/wacom.c renamed from drivers/usb/input/wacom.c.orig +2 -4
@@ -870,8 +870,7 @@ static int wacom_probe(struct usb_interf
 	strlcat(wacom->phys, "/input0", sizeof(wacom->phys));
 
 	wacom->features = wacom_features + (id - wacom_ids);
-	if (wacom->features->pktlen > 10)
-		BUG();
+	BUG_ON(wacom->features->pktlen > 10);
 
 	input_dev->name = wacom->features->name;
 	usb_to_input_id(dev, &input_dev->id);
@@ -936,8 +935,7 @@ static int wacom_probe(struct usb_interf
 
 	endpoint = &intf->cur_altsetting->endpoint[0].desc;
 
-	if (wacom->features->pktlen > 10)
-		BUG();
+	BUG_ON(wacom->features->pktlen > 10);
 
 	usb_fill_int_urb(wacom->irq, dev,
 			 usb_rcvintpipe(dev, endpoint->bEndpointAddress),

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors