Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp638193pxm; Thu, 3 Mar 2022 01:18:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRyIACBaz72ufuKDGfWmPNUaK4juCtlCTi+ANloo41HkMYlntEcgMdm1+8JcWBdQ+OL5/T X-Received: by 2002:a17:906:6a0f:b0:6d7:1021:2bd2 with SMTP id qw15-20020a1709066a0f00b006d710212bd2mr8739832ejc.395.1646299087158; Thu, 03 Mar 2022 01:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646299087; cv=none; d=google.com; s=arc-20160816; b=ykFWUiPipFvzF0k4o3z5pcZILgtax1O+9/K2G8kvOUNJ4sXAkBJxrTGUvjAMSQUH9u gU/31RvedEXWGesPP/+fL1WyexmeAwNwTBd3+n9oIHDNdMSs3hvy1c5+31H18Ae3aCBn h7aj0cJlAGElbPlm92gCyhCUwThuFgL46WvCs3KwuPzf5CLKN/Bvch6cR6Q8iEouwwUJ bw3Exf7ap6+xf51meESgVMMKYPbCwK7XStNQbr/aJu/tdBJr6MGx9XlJaYrFp6O+Izww Q/2+uNYCCyVqFutnZ9Thp6uZcAIy118aa7sGw7FR2Shj2NUgOhd9CFKI3FIyEB4E1v0z 1u1Q== 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=tnqvwPYi3nnJbMQEuJpHuoWXxLv4DTHhrYEBe9Mt7tI=; b=hL/yoIX1rQ08JOUemqRFen4ZVBK2roA9HcnSYBzaHj9q6bASpFEp4d6VgZIloW5r/O apwGioSSJQRi0q62eaXny7bSOgA3/RJTr0oySAprG2hVn2YGj2oKLWbQBMD1ytGOD8OB uDaxiNgI9azGQlTvpgeekuhNluGbZ4T/c85Pek8Gy/N4rlMT722QPOh63HqfSiUaY3sX vpex4MAtM+Q1kNBuE1piIz+gpggtYrAmJCI7SC6pQrzmuSwsNO7MzbAGpZD8dPVFr3Pg dJOUaT1XoyPVAHxWALeHXFJv/I42Ecbn+txwXLcBVhpYoh61WpFLetRuLMq1ZohX6RjN 25Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a508a84000000b00413ada18ac0si962750edj.136.2022.03.03.01.17.44; Thu, 03 Mar 2022 01:18:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbiCCIv3 (ORCPT + 99 others); Thu, 3 Mar 2022 03:51:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiCCIv2 (ORCPT ); Thu, 3 Mar 2022 03:51:28 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78997175867 for ; Thu, 3 Mar 2022 00:50:42 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-03 (Coremail) with SMTP id rQCowADHzsJXgSBi1y6qAQ--.4443S2; Thu, 03 Mar 2022 16:50:32 +0800 (CST) From: Jiasheng Jiang To: a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: patches@opensource.cirrus.com, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq Date: Thu, 3 Mar 2022 16:50:30 +0800 Message-Id: <20220303085030.291793-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowADHzsJXgSBi1y6qAQ--.4443S2 X-Coremail-Antispam: 1UD129KBjvJXoWrtFW8tF43Xry3Gw4fXF4DXFb_yoW8JrWUpF 42kry7CryFg3yru3WF9ry7Jrs8Ga1xtrW0grWjkws2vFyfArn5Jr4DZFyjqr1UGFWrta4q vw43Kr4rur18ArDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVWxJr 0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK67AK6r43 MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr 0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0E wIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJV W8JwCI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3Jr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1l IxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUjxR65UUUU U== X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the potential failure of the wm8350_register_irq(), it should be better to check it and return error if fails. Also, it need not free 'wm_rtc->rtc' since it will be freed automatically. Fixes: 077eaf5b40ec ("rtc: rtc-wm8350: add support for WM8350 RTC") Signed-off-by: Jiasheng Jiang --- drivers/rtc/rtc-wm8350.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c index 2018614f258f..6eaa9321c074 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c @@ -432,14 +432,21 @@ static int wm8350_rtc_probe(struct platform_device *pdev) return ret; } - wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, + ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350_rtc_update_handler, 0, "RTC Seconds", wm8350); + if (ret) + return ret; + wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); - wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, + ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, wm8350_rtc_alarm_handler, 0, "RTC Alarm", wm8350); + if (ret) { + wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350); + return ret; + } return 0; } -- 2.25.1