From ede69b3b5a92a543280643db6fa6163b8a7663f2 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Mon, 7 Apr 2008 02:22:43 -0300 Subject: [PATCH] --- yaml --- r: 92784 b: refs/heads/master c: 97f26ff6049a7fff5460cebe392ad1d699dc434c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index ff98933d3b15..871a1eb3e84f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e5be15c63804e05b5a94197524023702a259e308 +refs/heads/master: 97f26ff6049a7fff5460cebe392ad1d699dc434c diff --git a/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 4f6bb58ca5fc..f907a56c587d 100644 --- a/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1854,10 +1854,19 @@ int pvr2_hdw_initialize(struct pvr2_hdw *hdw, void *callback_data) { LOCK_TAKE(hdw->big_lock); do { + if (hdw->flag_disconnected) { + /* Handle a race here: If we're already + disconnected by this point, then give up. If we + get past this then we'll remain connected for + the duration of initialization since the entire + initialization sequence is now protected by the + big_lock. */ + break; + } hdw->state_data = callback_data; hdw->state_func = callback_func; + pvr2_hdw_setup(hdw); } while (0); LOCK_GIVE(hdw->big_lock); - pvr2_hdw_setup(hdw); return hdw->flag_init_ok; }