From patchwork Thu Aug 19 12:11:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Bin X-Patchwork-Id: 12446989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94B49C4338F for ; Thu, 19 Aug 2021 12:11:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B543610E5 for ; Thu, 19 Aug 2021 12:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238286AbhHSMLr (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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;