Skip to content

Commit 2e701a3

Browse files
ao2Jiri Kosina
authored andcommitted
HID: sony: Coding style cleanups in sixaxis_set_operational_usb()
Don't mix declaration and allocation, remove some useless newlines between calling a function and checking its return value. Signed-off-by: Antonio Ospite <[email protected]> Acked-by: Frank Praznik <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent dad89ad commit 2e701a3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/hid/hid-sony.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,17 +1131,17 @@ static void sony_input_configured(struct hid_device *hdev,
11311131
*/
11321132
static int sixaxis_set_operational_usb(struct hid_device *hdev)
11331133
{
1134-
int ret;
11351134
const int buf_size =
11361135
max(SIXAXIS_REPORT_0xF2_SIZE, SIXAXIS_REPORT_0xF5_SIZE);
1137-
__u8 *buf = kmalloc(buf_size, GFP_KERNEL);
1136+
__u8 *buf;
1137+
int ret;
11381138

1139+
buf = kmalloc(buf_size, GFP_KERNEL);
11391140
if (!buf)
11401141
return -ENOMEM;
11411142

11421143
ret = hid_hw_raw_request(hdev, 0xf2, buf, SIXAXIS_REPORT_0xF2_SIZE,
11431144
HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
1144-
11451145
if (ret < 0) {
11461146
hid_err(hdev, "can't set operational mode: step 1\n");
11471147
goto out;
@@ -1153,14 +1153,12 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
11531153
*/
11541154
ret = hid_hw_raw_request(hdev, 0xf5, buf, SIXAXIS_REPORT_0xF5_SIZE,
11551155
HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
1156-
11571156
if (ret < 0) {
11581157
hid_err(hdev, "can't set operational mode: step 2\n");
11591158
goto out;
11601159
}
11611160

11621161
ret = hid_hw_output_report(hdev, buf, 1);
1163-
11641162
if (ret < 0)
11651163
hid_err(hdev, "can't set operational mode: step 3\n");
11661164

0 commit comments

Comments
 (0)