From patchwork Wed Mar 23 07:55:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 8647461 Return-Path: X-Original-To: patchwork-tpmdd-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7907D9F38C for ; Wed, 23 Mar 2016 07:55:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A61FE2025B for ; Wed, 23 Mar 2016 07:55:53 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AB28B2038D for ; Wed, 23 Mar 2016 07:55:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aiddv-0005r3-Dm; Wed, 23 Mar 2016 07:55:51 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aiddt-0005qn-QR for tpmdd-devel@lists.sourceforge.net; Wed, 23 Mar 2016 07:55:49 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.67 as permitted sender) client-ip=74.125.82.67; envelope-from=christophe.ricard@gmail.com; helo=mail-wm0-f67.google.com; Received: from mail-wm0-f67.google.com ([74.125.82.67]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1aiddt-0006s6-2Y for tpmdd-devel@lists.sourceforge.net; Wed, 23 Mar 2016 07:55:49 +0000 Received: by mail-wm0-f67.google.com with SMTP id u125so2209759wmg.0 for ; Wed, 23 Mar 2016 00:55:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nq4fdqrqJ3jrp5WqtOGUo5F3DtKVKjNEFWmuX0L/uDc=; b=eMTo5CC60wKDyiww85VSICurrF077iIlpLk9wYIJmQto/zPShRzbbaoXAfTdJVNOUm LYmOmpMdfw7IOjnVI8ghL6K8I7Pc93lVJdzFElxKPmdw/a7X5JrClRnrSdzPYcNT+QNL 4sP00ftyiffZCzwkk7dK+SNsayBnitV8xpkrLM2hKMcTzWuTkprygzKCFKaoP2TXVn/8 53tLecXcXYq2aMEKNahKaLw7zvcCJYzTP61Kvu1JBWhX/DWpXrjI3qJwRixGleN1xs6I MN8iIzccmwPnx/4QazCsjEoKuOnVgV919IiY7QMgKqM0mhM+UiYNuG0VcQCxef8VGRCo a6ZA== X-Gm-Message-State: AD7BkJLsS7pIVFgAU+3WEe6l266dHARaEIksvj6S8GMJbPeiDBDJmQgjKMGJqleM//IpIQ== X-Received: by 10.194.92.226 with SMTP id cp2mr1665602wjb.180.1458719743058; Wed, 23 Mar 2016 00:55:43 -0700 (PDT) Received: from localhost.localdomain (ax113-6-78-236-204-66.fbx.proxad.net. [78.236.204.66]) by smtp.gmail.com with ESMTPSA id bg1sm1196194wjc.27.2016.03.23.00.55.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 00:55:41 -0700 (PDT) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: jarkko.sakkinen@linux.intel.com Date: Wed, 23 Mar 2016 08:55:33 +0100 Message-Id: <1458719734-13752-3-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458719734-13752-1-git-send-email-christophe-h.ricard@st.com> References: <1458719734-13752-1-git-send-email-christophe-h.ricard@st.com> X-Spam-Score: -1.6 (-) X-Headers-End: 1aiddt-0006s6-2Y Cc: jean-luc.blanc@st.com, ashley@ashleylai.com, tpmdd-devel@lists.sourceforge.net, christophe-h.ricard@st.com, benoit.houyere@st.com Subject: [tpmdd-devel] [PATCH 2/3] tpm/st33zp24/spi: Drop two useless checks in ACPI probe path X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,HK_RANDOM_ENVFROM,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 When st33zp24_spi_acpi_request_resources() gets called we already know that the entries in ->acpi_match_table have matched ACPI ID of the device. In addition spi_device pointer cannot be NULL in any case (otherwise I2C core would not call ->probe() for the driver in the first place). Drop the two useless checks from the driver. Signed-off-by: Christophe Ricard Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/st33zp24/spi.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 6be51ac..608dbc6 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -232,19 +232,8 @@ static const struct st33zp24_phy_ops spi_phy_ops = { static int st33zp24_spi_acpi_request_resources(struct spi_device *spi_dev) { struct st33zp24_spi_phy *phy = spi_get_drvdata(spi_dev); - const struct acpi_device_id *id; struct gpio_desc *gpiod_lpcpd; - struct device *dev; - - if (!spi_dev) - return -EINVAL; - - dev = &spi_dev->dev; - - /* Match the struct device against a given list of ACPI IDs */ - id = acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return -ENODEV; + struct device *dev = &spi_dev->dev; /* Get LPCPD GPIO from ACPI */ gpiod_lpcpd = devm_gpiod_get_index(dev, "TPM IO LPCPD", 1,