Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp429457pxm; Wed, 2 Mar 2022 01:08:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJymdWsiKxe5oXbd0NEvVtaCGVB90ntZmlqsFXzZgsnKz8XWzfAssf+7A73hF8F1qRqX44T9 X-Received: by 2002:a17:907:6e03:b0:6d9:9a96:ca1f with SMTP id sd3-20020a1709076e0300b006d99a96ca1fmr1798333ejc.735.1646212097754; Wed, 02 Mar 2022 01:08:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646212097; cv=none; d=google.com; s=arc-20160816; b=CNVfXcgGVcaa7wnKAvCgXXtaLE/Yj5+8qIEtvOk2wKdKm/h3FHjWFnrBP62HXaP17F 9tm7Odl/2aDHEPwOa2rcicyJYSr4aQN/lXwqDK9kPMlOm2HGVztE/J7mX7o4DgmiqWys cXdr8gSk8aW/EUrYfLOeymptpY7kEH8gqg+DhHwjOi4FTqmhy3Uz/6vQXln2iM9FrDg1 j08xn8lWDNcE47b4Rln4gtASd68PjEgONfVTNPc/COsX2Z6pnNTg2u1GJ4tJFwn9bW6U MqrfZcqIm/fcZ0KFWko85eU3Omn9Q4N5+iVAvX/rScFeW+nRH4CY8Z+aG9sX5r50khQ5 YcYw== 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=EO7QSqLtwHEoyZhR7RyDvshwW7i5ZB9Zvy08TP6xPz0=; b=08uqZn074Gix7oiz/iGS6HRiO/Mjs4iHyuMgCONEzewKnLmxS3iOkA0uSULoY23DeS aRRApSSfu/XBEvllAArRs3bAnAn3jQWcoVMRCsjAmjKvH4P/fFIB99YJ+nZUhjBiM7O3 dS3rsH1DpfHvgFHWmIXUvrE8aewMho9p5cqeB4NbM+XNr1ytAoWMxXuwOYFFaBapvTgS EN22nx5hjBmIckBCzrKZaFUhaJO6JHwWCF8ysM+O6mkpbE7oZVEeHkRhglBZqcdURvkR sCQtHvheOGDs4c9kgO55hsFxof/PtAp3eNqiUUzzJE57kpkwKRAkWjmYrw3gktYpmpSF 6QIQ== 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 m21-20020a056402431500b00415b37bf682si1477203edc.528.2022.03.02.01.07.54; Wed, 02 Mar 2022 01:08:17 -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 S234816AbiCBIoO (ORCPT + 99 others); Wed, 2 Mar 2022 03:44:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbiCBIoM (ORCPT ); Wed, 2 Mar 2022 03:44:12 -0500 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5ADDF3B55F for ; Wed, 2 Mar 2022 00:43:29 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-01 (Coremail) with SMTP id qwCowADnLscqLh9iU9AFAg--.5230S2; Wed, 02 Mar 2022 16:43:22 +0800 (CST) From: Jiasheng Jiang To: codrin.ciubotariu@microchip.com, arnd@arndb.de, gregkh@linuxfoundation.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@microchip.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] misc: atmel-ssc: Handle error for clk_prepare_enable Date: Wed, 2 Mar 2022 16:43:19 +0800 Message-Id: <20220302084319.96435-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qwCowADnLscqLh9iU9AFAg--.5230S2 X-Coremail-Antispam: 1UD129KBjvdXoWrtw4DZw4kXw47Kw43KF1DAwb_yoWkWrg_Ca 18ursrWr4Ykrs3Kw1UGr13uryDur4qqFyrXr1Iqay3tryDAw17urWDZrs8Ary7uw40yry3 G3Wqq3ySkrWagjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbcAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8ZwCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjfUeHUDDUUUU 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 clk_prepare_enable(), it should be better to check it and return error if fails. Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91") Signed-off-by: Jiasheng Jiang --- drivers/misc/atmel-ssc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index d6cd5537126c..c76ca234af4b 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -192,6 +192,7 @@ static int ssc_probe(struct platform_device *pdev) struct resource *regs; struct ssc_device *ssc; const struct atmel_ssc_platform_data *plat_dat; + int ret; ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); if (!ssc) { @@ -226,7 +227,10 @@ static int ssc_probe(struct platform_device *pdev) } /* disable all interrupts */ - clk_prepare_enable(ssc->clk); + ret = clk_prepare_enable(ssc->clk); + if (ret) + return ret; + ssc_writel(ssc->regs, IDR, -1); ssc_readl(ssc->regs, SR); clk_disable_unprepare(ssc->clk); -- 2.25.1