Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2814831pxb; Mon, 18 Apr 2022 08:47:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB7VrE7q9MBxuGGWJD+8DNGG3OVVdep12DCvBovFZsU4uVVmhjVVlygRfs/qizbxQkXd45 X-Received: by 2002:a17:907:628e:b0:6d9:c6fa:6168 with SMTP id nd14-20020a170907628e00b006d9c6fa6168mr9600310ejc.132.1650296860446; Mon, 18 Apr 2022 08:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650296860; cv=none; d=google.com; s=arc-20160816; b=oJVJB9FHXzVQIr0KnLQgMNKHG5jeAbK2gEOqoE+pxVfDH36z5xXf1ORDz/laUYoCqO afBdzungu6kQZXpHJugVtNDLjranHrR3r0VAu6Cn4PsS1aVRl6zcYHm7WR9mcrxsTW+x qxjO3v/TlhkgXo4uyMyeOrFjDYz13Qs/2O9ttrUcX8N6lkbwB1RITkMpEeQcHUT53PJt jmUhfYKVhiZY8ql878n/3JuF7WoyvxSkf6mOSketW9v+oz3mi59rkBX2N0GC5Mc3oCvf e1oJ1x1uIMZ7l3IHveZ2YHOdNS80zeXYunOb/GYzI2ANb2Y7qkcg3gIjRKpsr59UfE2F 8b5g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BHu3m+Z4CdX0xhtG29wxsSF4T+TzaXYDZiKNLpi6mKw=; b=ROFaWstFphb8nnQkpP4Pbyc5aN5g08WUxDnoGh3q9BZgyR9gPX6taohPS4c7A8m3XB UFJFRMPErwqbIootez8L3lKOjIhdimLRDkmIRlQ1SUi16P4a7N51Uyy1N7FGm7Tdr//p Nxyx/NpZA5cW7uS1ILanHZ3HFFQCbpuG6dBbsefvZl4ZAPIxe0dfm40MworJzRdrkj2j Orucv86ZxRCRgFnPaSLiUhxKOKwb5+BSue3EiMqrJ3ClZdjA7lNw6bzkvc/nu95xvpw2 tS0h7iAJntRur6/hS40m7UCKqJZqOdvQ/BKsdGlH8LoGHu3jWf+SkkWQmkNo/jCo9GZh k2qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eiow22Lk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a170906078100b006e86da92b15si6738507ejc.904.2022.04.18.08.47.16; Mon, 18 Apr 2022 08:47:40 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eiow22Lk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245032AbiDRN61 (ORCPT + 99 others); Mon, 18 Apr 2022 09:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243442AbiDRNbE (ORCPT ); Mon, 18 Apr 2022 09:31:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 102E21FA4E; Mon, 18 Apr 2022 05:57:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40822612D2; Mon, 18 Apr 2022 12:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E992C385A8; Mon, 18 Apr 2022 12:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286661; bh=LuEfd754+skVRsXBOYpUVZoniJBQ7Z5yYclhDdn+tnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eiow22Lk+tcagPfSfOVYMrE2GrT2jXkTRWhN5GMK/zg2McvLVzYpIzxUXxcQYZFCM l19sJpR3Av1GpHZpO+cQtlLYWMtnlKkvZ4/olAkX5TNjTOM5cy7iLTGZ8sxcIb3MVp tu/s51uIx0XmBvrMuS6V8O8aVhnsNuG1OnViE98Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Charles Keepax , Alexandre Belloni , Sasha Levin Subject: [PATCH 4.14 204/284] rtc: wm8350: Handle error for wm8350_register_irq Date: Mon, 18 Apr 2022 14:13:05 +0200 Message-Id: <20220418121217.525090833@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 From: Jiasheng Jiang [ Upstream commit 43f0269b6b89c1eec4ef83c48035608f4dcdd886 ] 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 Acked-by: Charles Keepax Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220303085030.291793-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- 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 483c7993516b..ed874e5c5fc8 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c @@ -441,14 +441,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.35.1