Bug 9266 - phonedev panics if unregistering device not registered
Summary: phonedev panics if unregistering device not registered
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 low
Assignee: drivers_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-31 09:31 UTC by Matti Linnanvuori
Modified: 2007-11-02 10:45 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.24-rc1-git8
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Matti Linnanvuori 2007-10-31 09:31:00 UTC
Most recent kernel where this bug did not occur: unknown
Problem Description:
phonedev panics if unregistering device not registered. Panic is inappropriate in such a case, which might be a driver bug.
Comment 1 Matti Linnanvuori 2007-10-31 10:05:57 UTC
From: Matti Linnanvuori <mattilinnanvuori@yahoo.com>

Remove panic from phonedev.

Signed-off-by: Matti Linnanvuori <mattilinnanvuori@yahoo.com>
---

--- a/drivers/telephony/phonedev.c	2007-10-31 17:52:55.784817000 +0200
+++ linux-2.6.24/drivers/telephony/phonedev.c	2007-10-31 17:55:48.144879000 +0200
@@ -120,9 +120,8 @@ int phone_register_device(struct phone_d
 void phone_unregister_device(struct phone_device *pfd)
 {
 	mutex_lock(&phone_lock);
-	if (phone_device[pfd->minor] != pfd)
-		panic("phone: bad unregister");
-	phone_device[pfd->minor] = NULL;
+	if (likely(phone_device[pfd->minor] == pfd))
+		phone_device[pfd->minor] = NULL;
 	mutex_unlock(&phone_lock);
 }
 




      Heute schon einen Blick in die Zukunft von E-Mails wagen? Versuchen Sie
Comment 2 Andrew Morton 2007-10-31 13:26:15 UTC
Thanks.

Can you please submit this patch vai email rather than via bugzilla?  Send
it to

Andrew Morton <akpm@linux-foundation.org>
linux-kernel@vger.kernel.org

(I wouldn't bother with the "likely": it's not a performance-critical function!)

Note You need to log in before you can comment on or make changes to this bug.