From c524b6e3bffcf4fec9dc082183cb90ef060ce050 Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" Date: Wed, 31 Aug 2011 14:35:57 -0700 Subject: [PATCH] --- yaml --- r: 268128 b: refs/heads/master c: 24326039b9685e8bfb1532932e18cb458f2a3517 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/staging/hv/connection.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 72fb885d46d4..26c8d7351b94 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7341d908af307a34098a9da52f49037d815c868f +refs/heads/master: 24326039b9685e8bfb1532932e18cb458f2a3517 diff --git a/trunk/drivers/staging/hv/connection.c b/trunk/drivers/staging/hv/connection.c index 9e99c044b23f..649b91bcd8c1 100644 --- a/trunk/drivers/staging/hv/connection.c +++ b/trunk/drivers/staging/hv/connection.c @@ -219,11 +219,25 @@ static void process_chn_event(u32 relid) */ channel = relid2channel(relid); + if (!channel) { + pr_err("channel not found for relid - %u\n", relid); + return; + } + + /* + * A channel once created is persistent even when there + * is no driver handling the device. An unloading driver + * sets the onchannel_callback to NULL under the + * protection of the channel inbound_lock. Thus, checking + * and invoking the driver specific callback takes care of + * orderly unloading of the driver. + */ + spin_lock_irqsave(&channel->inbound_lock, flags); - if (channel && (channel->onchannel_callback != NULL)) + if (channel->onchannel_callback != NULL) channel->onchannel_callback(channel->channel_callback_context); else - pr_err("channel not found for relid - %u\n", relid); + pr_err("no channel callback for relid - %u\n", relid); spin_unlock_irqrestore(&channel->inbound_lock, flags); }