Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp515301pxb; Thu, 19 Aug 2021 05:13:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx294k7YPUyiqt46QTyP9GTnoWCZfsu6q22pfih7Sc3fuvgL5yfADTTFFbUAiOTaRHS+sy8 X-Received: by 2002:a05:6402:51d2:: with SMTP id r18mr16320588edd.376.1629375188015; Thu, 19 Aug 2021 05:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629375188; cv=none; d=google.com; s=arc-20160816; b=ovGlSnElxHt/znRWOanI4IuJfcBMApNbS2a0IAQSXh0aLS1EzpEMah8C0uIJ2HSKuv Dd7c8yf3jKn869FjnJjPl28Rs2wlrzmlWKi0+VNTA1kbZQoNmqOgKlBuA/HbtU0laFM+ XWp11Q0rgdV5PRuZxduvQyh4U1GbaXS3Sn8hJuL/4BjDkxIiHChsYBoKvuvNzb9abCxx s0sHrROBR4jsEvnFyMdm6EffQ0eCje39kg5TLwfoDuO6F6d717X1p0n4AeVclnAHFQGX WhKawktt/cG7PmH5imsJTbK5dR4PlQjSBjz6BdpZ60/dlPt0UDwjvfnsDj1FFx1nDeKP RE0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qxgkDsZ+RS7LMnhLANBQhbqgu+CMngu+wHUlREbcDes=; b=KBcuUowmapLDnB1VNK1xyikRkaRH82SP/elld3o+ebo06JJROFrc+3BD/c8OkeiQLU 13yW3DRI1EWZ8wZrByorCkubTchFbBdQEPSHGNwMk43ShQHwuzO0NfxuFjw7wmzHFfnt Et5hxlWT8mwGmFfYqZWBHMeXds1hO3IcxrsPVQe7glfVj+1QACI72lryNcuEYeJMUG0X fb3JLBCD+lNMc/YyLJUi0e+4hY3h5UubrQeepi3MOx5u+teMhORWS5e0rUFeDy/w/Ggf 9kxIIUo6RPuUvx+wVujdwkCCMSK5LbcIErcCivwXqOPGfNzm4iw78Fo8TFEml4xdEjOv 1SMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr6si3561799ejc.711.2021.08.19.05.12.41; Thu, 19 Aug 2021 05:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238398AbhHSMLr (ORCPT + 99 others); Thu, 19 Aug 2021 08:11:47 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:61572 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238105AbhHSMLr (ORCPT ); Thu, 19 Aug 2021 08:11:47 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.17]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee3611e4a4dd56-d12e0; Thu, 19 Aug 2021 20:10:56 +0800 (CST) X-RM-TRANSID: 2ee3611e4a4dd56-d12e0 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id 2ee9611e4a4cc99-acfa4; Thu, 19 Aug 2021 20:10:55 +0800 (CST) X-RM-TRANSID: 2ee9611e4a4cc99-acfa4 From: Tang Bin To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Tang Bin , Zhang Shengju Subject: [PATCH] power: supply: cpcap-battery: remove redundant check Date: Thu, 19 Aug 2021 20:11:37 +0800 Message-Id: <20210819121137.11928-1-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the function cpcap_battery_probe(), the check of '!match->data' can actually never happen for the driver. First, this probe function will only be called if there is a match with an entry from the OF device ID table, and then all entries have .data set to a valid point. So remove the redundant check. Co-developed-by: Zhang Shengju Signed-off-by: Zhang Shengju Signed-off-by: Tang Bin --- drivers/power/supply/cpcap-battery.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index 8d62d4241..a3866826b 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c @@ -1035,12 +1035,6 @@ static int cpcap_battery_probe(struct platform_device *pdev) if (!match) return -EINVAL; - if (!match->data) { - dev_err(&pdev->dev, "no configuration data found\n"); - - return -ENODEV; - } - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) return -ENOMEM; -- 2.20.1.windows.1