aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-07-16 08:59:18 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-19 12:24:09 -0400
commit4eef404fd91543dc82be2bd05d3b29919ec6c0e6 (patch)
treed61d02b734d25083e2827b4f41d9f261fa610d05
parent40df3a7e586df59190547fe0e7d9928da735eada (diff)
[media] cec: don't set fh to NULL in CEC_TRANSMIT
The filehandle was set to NULL when in non-blocking mode or when no reply is needed. This is wrong: the filehandle is needed in non-blocking mode to ensure that the result of the transmit can be obtained through CEC_RECEIVE. And the 'reply' check was also incorrect since it should have checked the timeout field (the reply can be 0). In any case, when in blocking mode there is no need to set the fh to NULL either. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/staging/media/cec/cec-api.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/staging/media/cec/cec-api.c
index 879f7d96e1a7..559f6500d114 100644
--- a/drivers/staging/media/cec/cec-api.c
+++ b/drivers/staging/media/cec/cec-api.c
@@ -189,15 +189,12 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
189 if (copy_from_user(&msg, parg, sizeof(msg))) 189 if (copy_from_user(&msg, parg, sizeof(msg)))
190 return -EFAULT; 190 return -EFAULT;
191 mutex_lock(&adap->lock); 191 mutex_lock(&adap->lock);
192 if (!adap->is_configured) { 192 if (!adap->is_configured)
193 err = -ENONET; 193 err = -ENONET;
194 } else if (cec_is_busy(adap, fh)) { 194 else if (cec_is_busy(adap, fh))
195 err = -EBUSY; 195 err = -EBUSY;
196 } else { 196 else
197 if (!block || !msg.reply)
198 fh = NULL;
199 err = cec_transmit_msg_fh(adap, &msg, fh, block); 197 err = cec_transmit_msg_fh(adap, &msg, fh, block);
200 }
201 mutex_unlock(&adap->lock); 198 mutex_unlock(&adap->lock);
202 if (err) 199 if (err)
203 return err; 200 return err;