Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3318820pxp; Tue, 8 Mar 2022 11:48:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY3ZM+ZvpqeDZnLrYPoWp2CR9jgT0kUQPQrl++K97EupX5dQBG6eA+QUcRQCOPTiLVJInV X-Received: by 2002:a17:90b:1d83:b0:1bf:39d7:207d with SMTP id pf3-20020a17090b1d8300b001bf39d7207dmr6511779pjb.130.1646768889181; Tue, 08 Mar 2022 11:48:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646768889; cv=none; d=google.com; s=arc-20160816; b=D0hK3b/mK86uAhit8dXN1Mb8hypClQhbvPF9wACuyYTmxgfNTEotQlYP3/TE2Pe6SQ +B+O27Vj5ftj2bjfk3Apz3a1CKErZpSuhQ+8W55KlV5SQw6dB6jUg94Xh+qY5VNn7Zrw kMGcDjDESr3k547BtkDKmTeEAw1//2E/sxPaAEoTxiRW528cSlzozAfjBi6GY2Rv29nK LIF/GclaoDprjT3dWFECv8Tr/r/MvUra3yiMu/81YPl26cD111rlvvYW4+1hr7HCpY6B TnhlV6RLK8cJPDxAYmxZG2QUbjGYqo8zXjSSGAy45Lx86q/D4KMSsVlanlPGE5t5x2l5 nkww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3KTl4ElrR6egwo8ztDejgkW8tDsDkxXuiRNEpanN/gA=; b=sds9Vnmh+Vx95gz43IOmoZcLN9qTNLh0Ge30rLHj4ixNOWu3Oc1CQzN1VLIXGRWv4j G4FwwLSh3aZQB+F+WIOCIGXTD/7Kh81h+waktrQpysxW5ce/0KDow62tWz8Sqb+cfTEb LQAcVpD2dGWcP5z6gM7BL79r0qbsFIgtaJRNYxueHsTDgUse8EAgg36xMQ+7K2qjTMBQ LaRqfuVZOiHnWXwaxg+3a6au+zb+Rn6E2QuXjB5UvFjxCqRwIFuvxwnotQ95jbh6lxcT LPh+lXwvvW0EI26shCboqeT1NOLjUSJ/qtucQuEOimAUndeR7vx3xjzdwmtZdFGvZlpC h9Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=O5vjCz54; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a63e850000000b003734187a0c6si16716835pgk.548.2022.03.08.11.47.51; Tue, 08 Mar 2022 11:48:09 -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; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=O5vjCz54; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348225AbiCHQfo (ORCPT + 99 others); Tue, 8 Mar 2022 11:35:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbiCHQfm (ORCPT ); Tue, 8 Mar 2022 11:35:42 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA32D33890; Tue, 8 Mar 2022 08:34:45 -0800 (PST) Received: (Authenticated sender: alexandre.belloni@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 113126000A; Tue, 8 Mar 2022 16:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646757284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3KTl4ElrR6egwo8ztDejgkW8tDsDkxXuiRNEpanN/gA=; b=O5vjCz54y9GLGSF4vOQLbB76EABhIISyBYYsBWBJJ9fShW2T7kj8yh57KRCAhR3TamwSdM YeQb3eGodOQytSOeF+jFIDm4lKL4R4PM9khZzZKLI0WRoc5EH96mFOA85ClRh6IJADDW6H LLqpjbfVHYKZ37OLM3RYQb3N6tS7i27v9YbI2yzEQzLgsiyjmwFesOmVUhasLGaXu5ILCf C0oKFq87Jyr2t4rSrZv3Mt/N5denEdpPgO0whug0JnTYsnk8XKrFNgCXo/5O/Afu5SplvN SJW/Kc2opjB6OAtj2Yrv9OwcMzoXWIK8fnzSIhLBgE+AHfLoDjitpjEVHSm4vA== Date: Tue, 8 Mar 2022 17:34:42 +0100 From: Alexandre Belloni To: Jiasheng Jiang Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rtc: snvs: Handle error for clk_enable Message-ID: References: <20220304072018.557237-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220304072018.557237-1-jiasheng@iscas.ac.cn> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 On 04/03/2022 15:20:18+0800, Jiasheng Jiang wrote: > As the potential failure of the clk_enable(), > it should be better to check it and return error > if fails. > > Fixes: edb190cb1734 ("rtc: snvs: make sure clock is enabled for interrupt handle") > Signed-off-by: Jiasheng Jiang > --- > drivers/rtc/rtc-snvs.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c > index bd929b0e7d7d..f273f7d873f8 100644 > --- a/drivers/rtc/rtc-snvs.c > +++ b/drivers/rtc/rtc-snvs.c > @@ -269,8 +269,11 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id) > struct snvs_rtc_data *data = dev_get_drvdata(dev); > u32 lpsr; > u32 events = 0; > + int ret; > > - clk_enable(data->clk); > + ret = clk_enable(data->clk); > + if (ret) > + return IRQ_NONE; I don't think you thought about the implication here, if this happens, then the interrupt will be considered spurious which is definitively not something we want. > > regmap_read(data->regmap, data->offset + SNVS_LPSR, &lpsr); > > -- > 2.25.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com