Skip to contentSkip to conversation

hid-sony: regression probing a SIXAXIS controller - wrong return value

PATCH In review Richard Nauber 2 participants 2 messages Dec 30, 2008 – Jan 3, 2009 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hid-sony: regression probing a SIXAXIS controller - wrong return value

This patch fixes a regression introduced in bd28ce00. It occurs when attaching a Sony SIXAXIS controller:

input: Sony PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/input/input9 sony 0003:054C:0268.0006: input,hiddev96,hidraw0: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-1/input0
sony: probe of 0003:054C:0268.0006 failed with error 17

The reason for this nasty behavior is a wrong return value emitted by sony_set_operational().

Carry on playing with your Christmas gifts,
Richard

---

drivers/hid/hid-sony.c +6 -3
index 86e563b..e807d2f 100644
@@ -65,12 +65,15 @@ static int sony_set_operational(struct hid_device *hdev)
                                 USB_RECIP_INTERFACE,
                                 (3 << 8) | 0xf2, ifnum, buf, 17,
                                 USB_CTRL_GET_TIMEOUT);
-       if (ret < 0)
-               dev_err(&hdev->dev, "can't set operational mode\n");
 
        kfree(buf);
 
-       return ret;
+       if (ret <= 0) {
+               dev_err(&hdev->dev, "can't set operational mode\n");
+               return (ret ? ret : -EIO );
+       }
+
+       return 0;
 }
 
 static int sony_probe(struct hid_device *hdev, const struct

hid_device_id *id)
--

#1 lore raw
Quoted 11 lines · Richard Nauber

This patch fixes a regression introduced in bd28ce00. It occurs when attaching a Sony SIXAXIS controller:

input: Sony PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/input/input9 sony 0003:054C:0268.0006: input,hiddev96,hidraw0: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-1/input0
sony: probe of 0003:054C:0268.0006 failed with error 17

The reason for this nasty behavior is a wrong return value emitted by sony_set_operational().

Hi Richard,

the similar patch fixing this issue is already in my queue [1], Marcin beat you in reporting this :) But thanks anyway!

[1] http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=commitdiff;h=7100c4281258f185d82430d1cab698de8db4ab75

Signature · 2 lines
Jiri Kosina
SUSE Labs