* [PATCH HID v1] HID:hid-magicmouse:Fix repeated initialization
@ 2023-07-05 13:46 Wang Ming
0 siblings, 0 replies; only message in thread
From: Wang Ming @ 2023-07-05 13:46 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel
Cc: opensource.kernel, Wang Ming
If the first report returns NULL,
there is no need to execute the
hid_register_report function a
second time.
Signed-off-by: Wang Ming <machel@vivo.com>
---
drivers/hid/hid-magicmouse.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index c9c968d4b36a..ae3c78ebb986 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -857,8 +857,10 @@ static int magicmouse_probe(struct hid_device *hdev,
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
report = hid_register_report(hdev, HID_INPUT_REPORT,
TRACKPAD_REPORT_ID, 0);
- report = hid_register_report(hdev, HID_INPUT_REPORT,
- DOUBLE_REPORT_ID, 0);
+ if (report) {
+ report = hid_register_report(hdev, HID_INPUT_REPORT,
+ DOUBLE_REPORT_ID, 0);
+ }
}
if (!report) {
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-05 13:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-05 13:46 [PATCH HID v1] HID:hid-magicmouse:Fix repeated initialization Wang Ming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox