Index: linux/drivers/media/dvb/bt8xx/dst.c =================================================================== RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/bt8xx/dst.c,v retrieving revision 1.41 diff -u -b -r1.41 dst.c --- linux/drivers/media/dvb/bt8xx/dst.c 21 Sep 2005 16:29:09 -0000 1.41 +++ linux/drivers/media/dvb/bt8xx/dst.c 18 Oct 2005 18:54:03 -0000 @@ -1122,9 +1122,11 @@ } state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE); + down(&state->dst_mutex); + if ((dst_comm_init(state)) < 0) { dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed."); - return -1; + goto error; } if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); @@ -1136,23 +1138,30 @@ if (retval < 0) { dst_pio_disable(state); dprintk(verbose, DST_DEBUG, 1, "write not successful"); - return retval; + goto error; } if ((dst_pio_disable(state)) < 0) { dprintk(verbose, DST_DEBUG, 1, "DST PIO disable failed !"); - return -1; + goto error; } if ((read_dst(state, &reply, GET_ACK) < 0)) { dprintk(verbose, DST_DEBUG, 1, "read verify not successful."); - return -1; + goto error; } if (reply != ACK) { dprintk(verbose, DST_DEBUG, 1, "write not acknowledged 0x%02x ", reply); - return 0; + goto error; } state->diseq_flags |= ATTEMPT_TUNE; - return dst_get_tuna(state); + retval = dst_get_tuna(state); + + up(&state->dst_mutex); + return retval; + +error: + up(&state->dst_mutex); + return -EIO; } /*