From patchwork Mon Jun 11 05:23:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhouyang Jia X-Patchwork-Id: 10457183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CA6D60234 for ; Mon, 11 Jun 2018 05:24:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1126B27F4B for ; Mon, 11 Jun 2018 05:24:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0562327F82; Mon, 11 Jun 2018 05:24:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA01F27F4B for ; Mon, 11 Jun 2018 05:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753750AbeFKFYC (ORCPT ); Mon, 11 Jun 2018 01:24:02 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35169 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752735AbeFKFYC (ORCPT ); Mon, 11 Jun 2018 01:24:02 -0400 Received: by mail-pg0-f68.google.com with SMTP id 15-v6so9176482pge.2; Sun, 10 Jun 2018 22:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cj9wXdp8pS9DKoRbfk2NrSh7hlosJB4rOwcJ3OStNI8=; b=dgNLxmy0zM2cYgyukp2DsAlA+cOS2+joQz6Sv29FK/I4OnZKiNx3OtHVNpRI8iOEfI RaKOfr0G6Zt4rQrDLnr8O6ZM6SHL08aRCK1juU4HB9VOmX/D1nJaQFmMQl4t3tO5KP2P 08j0oQfiuZexF6D87gSi8t5r4eS0Yy58AQyyLiaRY7bXZyY7hgxRzSO3p3OPLqwLoLza nkAa3fT3Avm54CooLEQiCO9IFNIY015ZzfdNHpyJwo60IUbKiR7QRFk1DT08wOVHoKFV bCp5jZAy2vKybnlmk/38blvf83uwMoLoJXyg/gxO27u+lXqwfUEvbdgNR25Rg2+zDZ1w p5vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cj9wXdp8pS9DKoRbfk2NrSh7hlosJB4rOwcJ3OStNI8=; b=IodGbY6kaywhbVl1EvmJmNKlazDVBTcevJ+Jb43bdeBmojYos8An0hENMN23OP4HPC eDgREtvl0G84anDP+FvvFJ7iehik1QKASDJQDtcGbAcGhFAfVBM2e0jiz8xa2eReumh2 eQ79VGkRLMfuVq1GgrvR3nMjiB9NrcYBDrZFO+Gh6rXgwcoojlKml+rPFeaO5GXlPDMs l6SNCX04Q9FWR0v7X1v2yFSDAbj4kNMRBdxlRQZkBeeMaedtuFlx5JaPl+dvXBSSjoQ6 WaknS8Beng7F+H+T0CfzsD+MpbkXQseop7B2ueW/5bjWpD/SlCx44y/V9RhYazxbMOsf 1+7A== X-Gm-Message-State: APt69E0ILuA73b0aZcrEzdoYR3L1a0mWQsSkIClWbCp7J8jnIBB1EiW8 8a//nS/yJif0IEj8o3JDFo8= X-Google-Smtp-Source: ADUXVKLyKdB95d1WsAALQ37Hm/+eG778LbalktSSNHOOqdWQU8jNSBsmS+B2nn2spMoL1lhlcxnDvA== X-Received: by 2002:a63:7f44:: with SMTP id p4-v6mr10920705pgn.416.1528694641661; Sun, 10 Jun 2018 22:24:01 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id t10-v6sm38793159pgn.20.2018.06.10.22.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jun 2018 22:24:01 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Support Opensource , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: add error handling for da9052_reg_write Date: Mon, 11 Jun 2018 13:23:39 +0800 Message-Id: <1528694619-31889-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When da9052_reg_write fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling da9052_reg_write. Signed-off-by: Zhouyang Jia --- drivers/input/touchscreen/da9052_tsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c index b5dfd594..60c82a0 100644 --- a/drivers/input/touchscreen/da9052_tsi.c +++ b/drivers/input/touchscreen/da9052_tsi.c @@ -319,8 +319,11 @@ static int da9052_ts_probe(struct platform_device *pdev) static int da9052_ts_remove(struct platform_device *pdev) { struct da9052_tsi *tsi = platform_get_drvdata(pdev); + int error; - da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x19); + error = da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x19); + if (error < 0) + return error; da9052_free_irq(tsi->da9052, DA9052_IRQ_TSIREADY, tsi); da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);