aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/joystick/sidewinder.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
index 2b2ec1057dee..95c0de7964a0 100644
--- a/drivers/input/joystick/sidewinder.c
+++ b/drivers/input/joystick/sidewinder.c
@@ -589,7 +589,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
589 struct sw *sw; 589 struct sw *sw;
590 struct input_dev *input_dev; 590 struct input_dev *input_dev;
591 int i, j, k, l; 591 int i, j, k, l;
592 int err; 592 int err = 0;
593 unsigned char *buf = NULL; /* [SW_LENGTH] */ 593 unsigned char *buf = NULL; /* [SW_LENGTH] */
594 unsigned char *idbuf = NULL; /* [SW_LENGTH] */ 594 unsigned char *idbuf = NULL; /* [SW_LENGTH] */
595 unsigned char m = 1; 595 unsigned char m = 1;
@@ -776,7 +776,10 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
776 goto fail4; 776 goto fail4;
777 } 777 }
778 778
779 return 0; 779 out: kfree(buf);
780 kfree(idbuf);
781
782 return err;
780 783
781 fail4: input_free_device(sw->dev[i]); 784 fail4: input_free_device(sw->dev[i]);
782 fail3: while (--i >= 0) 785 fail3: while (--i >= 0)
@@ -784,9 +787,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
784 fail2: gameport_close(gameport); 787 fail2: gameport_close(gameport);
785 fail1: gameport_set_drvdata(gameport, NULL); 788 fail1: gameport_set_drvdata(gameport, NULL);
786 kfree(sw); 789 kfree(sw);
787 kfree(buf); 790 goto out;
788 kfree(idbuf);
789 return err;
790} 791}
791 792
792static void sw_disconnect(struct gameport *gameport) 793static void sw_disconnect(struct gameport *gameport)