[PATCH 14/21] media: av7110: coding style fixes: assignments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes the following checkpatch errors:

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided

Signed-off-by: Stefan Herdler <herdler@xxxxxxxxxxxxxx>
---
 drivers/staging/media/av7110/av7110.c       | 30 ++++++++++++++++-----
 drivers/staging/media/av7110/av7110_av.c    | 18 ++++++++-----
 drivers/staging/media/av7110/av7110_hw.c    |  6 +++--
 drivers/staging/media/av7110/av7110_ipack.c |  3 ++-
 drivers/staging/media/av7110/dvb_filter.c   |  3 ++-
 5 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
index 78d708ffc..fac774dc6 100644
--- a/drivers/staging/media/av7110/av7110.c
+++ b/drivers/staging/media/av7110/av7110.c
@@ -709,7 +709,11 @@ static inline int SetPIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,

 	if (vpid == 0x1fff || apid == 0x1fff ||
 	    ttpid == 0x1fff || subpid == 0x1fff || pcrpid == 0x1fff) {
-		vpid = apid = ttpid = subpid = pcrpid = 0;
+		vpid = 0;
+		apid = 0;
+		ttpid = 0;
+		subpid = 0;
+		pcrpid = 0;
 		av7110->pids[DMX_PES_VIDEO] = 0;
 		av7110->pids[DMX_PES_AUDIO] = 0;
 		av7110->pids[DMX_PES_TELETEXT] = 0;
@@ -855,7 +859,11 @@ static int dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed)

 	dprintk(4, "%p\n", av7110);

-	npids[0] = npids[1] = npids[2] = npids[3] = npids[4] = 0xffff;
+	npids[0] = 0xffff;
+	npids[1] = 0xffff;
+	npids[2] = 0xffff;
+	npids[3] = 0xffff;
+	npids[4] = 0xffff;
 	i = dvbdmxfeed->pes_type;
 	npids[i] = (pid[i] & 0x8000) ? 0 : pid[i];
 	if ((i == 2) && npids[i] && (dvbdmxfeed->ts_type & TS_PACKET)) {
@@ -907,7 +915,11 @@ static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed)
 		if (!av7110->playing)
 			dvbdmx->playing = 0;
 	}
-	npids[0] = npids[1] = npids[2] = npids[3] = npids[4] = 0xffff;
+	npids[0] = 0xffff;
+	npids[1] = 0xffff;
+	npids[2] = 0xffff;
+	npids[3] = 0xffff;
+	npids[4] = 0xffff;
 	i = dvbdmxfeed->pes_type;
 	switch (i) {
 	case 2: //teletext
@@ -1407,10 +1419,13 @@ u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg)

 	msgs[0].flags = 0;
 	msgs[1].flags = I2C_M_RD;
-	msgs[0].addr = msgs[1].addr = id / 2;
+	msgs[0].addr = id / 2;
+	msgs[1].addr = id / 2;
 	mm1[0] = reg;
-	msgs[0].len = 1; msgs[1].len = 1;
-	msgs[0].buf = mm1; msgs[1].buf = mm2;
+	msgs[0].len = 1;
+	msgs[1].len = 1;
+	msgs[0].buf = mm1;
+	msgs[1].buf = mm2;
 	i2c_transfer(&av7110->i2c_adap, msgs, 2);

 	return mm2[0];
@@ -1511,7 +1526,8 @@ static int get_firmware(struct av7110 *av7110)

 	memcpy(av7110->bin_fw, fw->data, fw->size);
 	av7110->size_fw = fw->size;
-	if ((ret = check_firmware(av7110)))
+	ret = check_firmware(av7110);
+	if (ret)
 		vfree(av7110->bin_fw);

 	release_firmware(fw);
diff --git a/drivers/staging/media/av7110/av7110_av.c b/drivers/staging/media/av7110/av7110_av.c
index 35af0cd6d..3e0db8e9a 100644
--- a/drivers/staging/media/av7110/av7110_av.c
+++ b/drivers/staging/media/av7110/av7110_av.c
@@ -81,8 +81,10 @@ int av7110_record_cb(struct dvb_filter_pes2ts *p2t, u8 *buf, size_t len)

 	if (!(dvbdmxfeed->ts_type & TS_PACKET))
 		return 0;
-	if (buf[3] == 0xe0)	 // video PES do not have a length in TS
-		buf[4] = buf[5] = 0;
+	if (buf[3] == 0xe0) {	 // video PES do not have a length in TS
+		buf[4] = 0;
+		buf[5] = 0;
+	}
 	if (dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY)
 		return dvbdmxfeed->cb.ts(buf, len, NULL, 0,
 					 &dvbdmxfeed->feed.ts, NULL);
@@ -282,7 +284,8 @@ int av7110_set_volume(struct av7110 *av7110, unsigned int volleft,
 			volleft = 0x3f;
 		if (volright > 0x3f)
 			volright = 0x3f;
-		if ((err = SendDAC(av7110, 3, 0x80 + volleft)))
+		err = SendDAC(av7110, 3, 0x80 + volleft);
+		if (err)
 			return err;
 		return SendDAC(av7110, 4, volright);

@@ -1513,7 +1516,8 @@ static int dvb_video_open(struct inode *inode, struct file *file)

 	dprintk(2, "av7110:%p, \n", av7110);

-	if ((err = dvb_generic_open(inode, file)) < 0)
+	err = dvb_generic_open(inode, file);
+	if (err < 0)
 		return err;

 	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
@@ -1524,7 +1528,8 @@ static int dvb_video_open(struct inode *inode, struct file *file)
 		av7110->videostate.stream_source = VIDEO_SOURCE_DEMUX;

 		/*  empty event queue */
-		av7110->video_events.eventr = av7110->video_events.eventw = 0;
+		av7110->video_events.eventr = 0;
+		av7110->video_events.eventw = 0;
 	}

 	return 0;
@@ -1631,7 +1636,8 @@ int av7110_av_register(struct av7110 *av7110)

 	init_waitqueue_head(&av7110->video_events.wait_queue);
 	spin_lock_init(&av7110->video_events.lock);
-	av7110->video_events.eventw = av7110->video_events.eventr = 0;
+	av7110->video_events.eventw = 0;
+	av7110->video_events.eventr = 0;
 	av7110->video_events.overflow = 0;
 	memset(&av7110->video_size, 0, sizeof(video_size_t));

diff --git a/drivers/staging/media/av7110/av7110_hw.c b/drivers/staging/media/av7110/av7110_hw.c
index d775dd632..52290a500 100644
--- a/drivers/staging/media/av7110/av7110_hw.c
+++ b/drivers/staging/media/av7110/av7110_hw.c
@@ -219,7 +219,8 @@ int av7110_bootarm(struct av7110 *av7110)
 	/* FIXME: Why does Nexus CA require 2x iwdebi for first init? */
 	iwdebi(av7110, DEBISWAP, DPRAM_BASE, 0x76543210, 4);

-	if ((ret=irdebi(av7110, DEBINOSWAP, DPRAM_BASE, 0, 4)) != 0x10325476) {
+	ret = irdebi(av7110, DEBINOSWAP, DPRAM_BASE, 0, 4);
+	if (ret != 0x10325476) {
 		printk(KERN_ERR "dvb-ttpci: debi test in av7110_bootarm() failed: %08x != %08x (check your BIOS 'Plug&Play OS' settings)\n",
 		       ret, 0x10325476);
 		return -1;
@@ -547,7 +548,8 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
 	if (mutex_lock_interruptible(&av7110->dcomlock))
 		return -ERESTARTSYS;

-	if ((err = __av7110_send_fw_cmd(av7110, request_buf, request_buf_len)) < 0) {
+	err = __av7110_send_fw_cmd(av7110, request_buf, request_buf_len);
+	if (err < 0) {
 		mutex_unlock(&av7110->dcomlock);
 		printk(KERN_ERR "dvb-ttpci: av7110_fw_request error %d\n", err);
 		return err;
diff --git a/drivers/staging/media/av7110/av7110_ipack.c b/drivers/staging/media/av7110/av7110_ipack.c
index c18a9f586..c41a233e1 100644
--- a/drivers/staging/media/av7110/av7110_ipack.c
+++ b/drivers/staging/media/av7110/av7110_ipack.c
@@ -22,7 +22,8 @@ void av7110_ipack_reset(struct ipack *p)
 int av7110_ipack_init(struct ipack *p, int size,
 		      void (*func)(u8 *buf, int size, void *priv))
 {
-	if (!(p->buf = vmalloc(size))) {
+	p->buf = vmalloc(size);
+	if (!p->buf) {
 		printk(KERN_WARNING "Couldn't allocate memory for ipack\n");
 		return -ENOMEM;
 	}
diff --git a/drivers/staging/media/av7110/dvb_filter.c b/drivers/staging/media/av7110/dvb_filter.c
index f92faae44..71c1d9629 100644
--- a/drivers/staging/media/av7110/dvb_filter.c
+++ b/drivers/staging/media/av7110/dvb_filter.c
@@ -99,7 +99,8 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
 	while (len >= 184) {
 		buf[3] = 0x10 | ((p2ts->cc++) & 0x0f);
 		memcpy(buf + 4, pes, 184);
-		if ((ret=p2ts->cb(p2ts->priv, buf)))
+		ret = p2ts->cb(p2ts->priv, buf);
+		if (ret)
 			return ret;
 		len -= 184; pes += 184;
 		buf[1] &= ~0x40;
--
2.34.0





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux