[-mm Patch] net/bluetooth/hidp/core.c: Make hidp_setup_input() return int

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: roel <12o3l@...>, <linux-kernel@...>, <bluez-devel@...>, <maxk@...>, Marcel Holtmann <marcel@...>
Date: Monday, September 24, 2007 - 7:30 am

This patch:
- makes hidp_setup_input() return int to indicate errors;
- checks its return value to handle errors.

And this time it is against -rc7-mm1 tree.

Thanks to roel and Marcel Holtmann for comments.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---
 net/bluetooth/hidp/core.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Index: linux-2.6.23-rc7-mm1/net/bluetooth/hidp/core.c
===================================================================
--- linux-2.6.23-rc7-mm1.orig/net/bluetooth/hidp/core.c
+++ linux-2.6.23-rc7-mm1/net/bluetooth/hidp/core.c
@@ -625,7 +625,7 @@ static struct device *hidp_get_device(st
 	return conn ? &conn->dev : NULL;
 }
 
-static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
+static inline int hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
 {
 	struct input_dev *input = session->input;
 	int i;
@@ -669,7 +669,7 @@ static inline void hidp_setup_input(stru
 
 	input->event = hidp_input_event;
 
-	input_register_device(input);
+	return input_register_device(input);
 }
 
 static int hidp_open(struct hid_device *hid)
@@ -822,8 +822,11 @@ int hidp_add_connection(struct hidp_conn
 	session->flags   = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID);
 	session->idle_to = req->idle_to;
 
-	if (session->input)
-		hidp_setup_input(session, req);
+	if (session->input) {
+		err = hidp_setup_input(session, req);
+		if (err < 0)
+			goto failed;
+	}
 
 	if (session->hid)
 		hidp_setup_hid(session, req);
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.23-rc7-mm1, Andrew Morton, (Mon Sep 24, 5:17 am)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 6:20 pm)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 3:41 pm)
Re: 2.6.23-rc7-mm1, Mel Gorman, (Tue Sep 25, 6:23 am)
Re: 2.6.23-rc7-mm1, Jens Axboe, (Tue Sep 25, 6:31 am)
Re: 2.6.23-rc7-mm1, Mel Gorman, (Tue Sep 25, 7:15 am)
Re: 2.6.23-rc7-mm1, Jens Axboe, (Tue Sep 25, 7:23 am)
Re: 2.6.23-rc7-mm1, Torsten Kaiser, (Mon Sep 24, 3:07 pm)
Re: 2.6.23-rc7-mm1, Andrew Morton, (Mon Sep 24, 3:34 pm)
Re: 2.6.23-rc7-mm1, Thomas Gleixner, (Mon Sep 24, 4:25 pm)
Re: 2.6.23-rc7-mm1, Torsten Kaiser, (Tue Sep 25, 3:32 am)
Re: 2.6.23-rc7-mm1, Thomas Gleixner, (Tue Sep 25, 3:44 am)
Re: 2.6.23-rc7-mm1 ia64 build issue in efi.c, Bob Picco, (Mon Sep 24, 11:18 am)
Re: 2.6.23-rc7-mm1, Reuben Farrelly, (Mon Sep 24, 10:52 am)
Re: 2.6.23-rc7-mm1, Andrew Morton, (Mon Sep 24, 12:59 pm)
Re: 2.6.23-rc7-mm1, J. Bruce Fields, (Mon Sep 24, 1:12 pm)
Re: 2.6.23-rc7-mm1, Reuben Farrelly, (Mon Sep 24, 5:31 pm)
[PATCH rc7-mm1] fix BUG at mm/swap.c:405!, Hugh Dickins, (Mon Sep 24, 9:17 am)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 9:13 am)
Re: 2.6.23-rc7-mm1, Andrew Morton, (Mon Sep 24, 12:44 pm)
Re: 2.6.23-rc7-mm1, Peter Zijlstra, (Mon Sep 24, 12:57 pm)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 1:08 pm)
Re: 2.6.23-rc7-mm1, Peter Zijlstra, (Mon Sep 24, 3:20 pm)
Re: 2.6.23-rc7-mm1, Peter Zijlstra, (Tue Sep 25, 7:05 am)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Tue Sep 25, 9:07 am)
Re: 2.6.23-rc7-mm1, Cedric Le Goater, (Mon Sep 24, 9:00 am)
Re: 2.6.23-rc7-mm1, Cedric Le Goater, (Mon Sep 24, 9:10 am)
Re: 2.6.23-rc7-mm1, Jens Axboe, (Mon Sep 24, 12:57 pm)
Re: 2.6.23-rc7-mm1, Vlad Yasevich, (Mon Sep 24, 9:29 am)
Re: 2.6.23-rc7-mm1, Jens Axboe, (Mon Sep 24, 12:58 pm)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 8:55 am)
Re: 2.6.23-rc7-mm1, Pavel Emelyanov, (Mon Sep 24, 9:10 am)
Re: 2.6.23-rc7-mm1, Balbir Singh, (Mon Sep 24, 9:21 am)
Re: 2.6.23-rc7-mm1, Pavel Emelyanov, (Mon Sep 24, 11:34 am)
Re: 2.6.23-rc7-mm1, Balbir Singh, (Mon Sep 24, 12:10 pm)
Re: 2.6.23-rc7-mm1, Cedric Le Goater, (Mon Sep 24, 8:47 am)
Re: 2.6.23-rc7-mm1, Jens Axboe, (Mon Sep 24, 12:56 pm)
2.6.23-rc7-mm1 -- powerpc rtas panic, Andy Whitcroft, (Mon Sep 24, 8:35 am)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Linas Vepstas, (Tue Oct 2, 7:28 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Tony Breeds, (Tue Oct 2, 8:26 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Michael Ellerman, (Tue Oct 2, 8:30 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Tony Breeds, (Tue Oct 2, 9:19 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Nish Aravamudan, (Thu Oct 4, 8:01 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Linas Vepstas, (Fri Oct 5, 12:03 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Nish Aravamudan, (Sun Oct 7, 11:47 pm)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Michael Ellerman, (Wed Oct 3, 12:09 am)
Re: 2.6.23-rc7-mm1 -- powerpc rtas panic, Linas Vepstas, (Wed Oct 3, 2:50 pm)
Re: 2.6.23-rc7-mm1, Jiri Slaby, (Mon Sep 24, 8:33 am)
Re: [linux-usb-devel] 2.6.23-rc7-mm1, Alan Stern, (Mon Sep 24, 10:41 am)
Re: [linux-usb-devel] 2.6.23-rc7-mm1, Jiri Slaby, (Mon Sep 24, 2:45 pm)
Re: [linux-usb-devel] 2.6.23-rc7-mm1, Alan Stern, (Mon Sep 24, 3:06 pm)
Re: [linux-usb-devel] 2.6.23-rc7-mm1, Jiri Slaby, (Mon Sep 24, 3:18 pm)
Re: [linux-usb-devel] 2.6.23-rc7-mm1, Alan Stern, (Mon Sep 24, 3:41 pm)
Re: [linux-usb-devel] 2.6.23-rc7-mm1, Jiri Slaby, (Sun Sep 30, 4:26 am)
2.6.23-rc7-mm1 -- s390 compile failures, Andy Whitcroft, (Mon Sep 24, 8:32 am)
Re: 2.6.23-rc7-mm1 -- s390 compile failures, Cedric Le Goater, (Mon Sep 24, 8:49 am)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 7:42 am)
[-mm Patch] net/bluetooth/hidp/core.c: Make hidp_setup_input..., WANG Cong, (Mon Sep 24, 7:30 am)
Re: 2.6.23-rc7-mm1 - 'touch' command causes Oops., Christoph Hellwig, (Mon Sep 24, 8:05 am)
Re: 2.6.23-rc7-mm1 - 'touch' command causes Oops., Dave Hansen, (Mon Sep 24, 11:45 am)
Re: 2.6.23-rc7-mm1 - 'touch' command causes Oops., Balbir Singh, (Mon Sep 24, 7:08 am)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 6:07 am)
Re: 2.6.23-rc7-mm1, Sam Ravnborg, (Mon Sep 24, 5:02 pm)
Re: 2.6.23-rc7-mm1, Sam Ravnborg, (Mon Sep 24, 5:36 pm)
Re: 2.6.23-rc7-mm1, Kamalesh Babulal, (Mon Sep 24, 7:27 pm)