From patchwork Fri Oct 2 11:28:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7314811 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C357BBEEA4 for ; Fri, 2 Oct 2015 11:28:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD33120880 for ; Fri, 2 Oct 2015 11:28:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAB9C20421 for ; Fri, 2 Oct 2015 11:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494AbbJBL2o (ORCPT ); Fri, 2 Oct 2015 07:28:44 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35728 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751342AbbJBL2o (ORCPT ); Fri, 2 Oct 2015 07:28:44 -0400 Received: by pacfv12 with SMTP id fv12so106943267pac.2; Fri, 02 Oct 2015 04:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=RB5G1V+mWt3UAv0XEgU9JcZhhclY/XUXoLrQqJmkKfc=; b=tr2F90SYzMOiTHmjaFl8tqYreeTvPxQF+COmCKJo8ZDKWJe9rXG4OaU9I5YRPI4Yji tTOqr/axx+T5MDNvZMHBcj3D334XlAmpdOAfzhCwVoe44Zs7Sd8gq0iyTDLFQW6Umdff DunxqKyICWnQwr2LOtIPRo5kx6NDPIbyg9P3ow+0BFtp7elG4DyOP8lzoPg4nPJZV1hE xlQpCKJ1tpEPMnELdxwm3phyHmC+JyPQ4FpPohbejAahiDAyN2xVaRmPU7ZcxxDhVzwA AWHINRRhq0rLNG4YtQeLpPFcSPCcV5SA6FKUTnrrlEFBTsywTBLunbG31cWezzjpYRyJ 9lXw== X-Received: by 10.66.250.197 with SMTP id ze5mr19755298pac.50.1443785323575; Fri, 02 Oct 2015 04:28:43 -0700 (PDT) Received: from localhost.localdomain ([49.206.244.224]) by smtp.gmail.com with ESMTPSA id k10sm11547735pbq.78.2015.10.02.04.28.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Oct 2015 04:28:42 -0700 (PDT) From: Sudip Mukherjee To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 1/3] Input: db9 - store object at correct index Date: Fri, 2 Oct 2015 16:58:33 +0530 Message-Id: <1443785315-31495-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The variable i is used to check the port to attach to and we are supposed to save the reference of struct db9 in the location given by db9_base[i]. But after finding out the index i is getting modified again so we saved in a wrong index. Fixes: 2260c419b52b ("Input: db9 - use parallel port device model") Signed-off-by: Sudip Mukherjee --- drivers/input/joystick/db9.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index cf1f602..f6ecd4a 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c @@ -560,7 +560,7 @@ static void db9_attach(struct parport *pp) const struct db9_mode_data *db9_mode; struct pardevice *pd; struct input_dev *input_dev; - int i, j; + int i, j, k; int mode; struct pardev_cb db9_parport_cb; @@ -577,6 +577,7 @@ static void db9_attach(struct parport *pp) pr_debug("Not using parport%d.\n", pp->number); return; } + k = i; mode = db9_cfg[i].args[DB9_ARG_MODE]; @@ -649,7 +650,7 @@ static void db9_attach(struct parport *pp) goto err_free_dev; } - db9_base[i] = db9; + db9_base[k] = db9; return; err_free_dev: @@ -676,6 +677,7 @@ static void db9_detach(struct parport *port) return; db9 = db9_base[i]; + db9_base[i] = NULL; for (i = 0; i < min(db9_modes[db9->mode].n_pads, DB9_MAX_DEVICES); i++) input_unregister_device(db9->dev[i]);