@@ -288,12 +288,10 @@ static void ims_pcu_gamepad_report(struct ims_pcu *pcu, u32 data)
static int ims_pcu_setup_gamepad(struct ims_pcu *pcu)
{
- struct ims_pcu_gamepad *gamepad;
- struct input_dev *input;
int error;
+ struct ims_pcu_gamepad *gamepad = kzalloc(sizeof(*gamepad), GFP_KERNEL);
+ struct input_dev *input = input_allocate_device();
- gamepad = kzalloc(sizeof(struct ims_pcu_gamepad), GFP_KERNEL);
- input = input_allocate_device();
if (!gamepad || !input) {
dev_err(pcu->dev,
"Not enough memory for gamepad device\n");
@@ -2003,10 +2001,9 @@ static int ims_pcu_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *udev = interface_to_usbdev(intf);
- struct ims_pcu *pcu;
int error;
+ struct ims_pcu *pcu = kzalloc(sizeof(*pcu), GFP_KERNEL);
- pcu = kzalloc(sizeof(struct ims_pcu), GFP_KERNEL);
if (!pcu)
return -ENOMEM;