Skip to content

Commit

Permalink
[media] saa7164: Replace if and BUG with BUG_ON
Browse files Browse the repository at this point in the history
Replace if condition and BUG() with a BUG_ON having the conditional
expression of the if statement as argument.

The Coccinelle semantic patch used to make this change is as follows:
@@ expression E,f; @@

(
  if (<+... f(...) ...+>) { BUG(); }
|
- if (E) { BUG(); }
+ BUG_ON(E);
)

Signed-off-by: Amitoj Kaur Chawla <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
musicakc authored and mchehab committed Jul 8, 2016
1 parent 654043f commit 2aefee0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/media/pci/saa7164/saa7164-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,7 @@ int saa7164_encoder_register(struct saa7164_port *port)

dprintk(DBGLVL_ENC, "%s()\n", __func__);

if (port->type != SAA7164_MPEG_ENCODER)
BUG();
BUG_ON(port->type != SAA7164_MPEG_ENCODER);

/* Sanity check that the PCI configuration space is active */
if (port->hwcfg.BARLocation == 0) {
Expand Down Expand Up @@ -1151,8 +1150,7 @@ void saa7164_encoder_unregister(struct saa7164_port *port)

dprintk(DBGLVL_ENC, "%s(port=%d)\n", __func__, port->nr);

if (port->type != SAA7164_MPEG_ENCODER)
BUG();
BUG_ON(port->type != SAA7164_MPEG_ENCODER);

if (port->v4l_device) {
if (port->v4l_device->minor != -1)
Expand Down

0 comments on commit 2aefee0

Please sign in to comment.