Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1862312pxm; Fri, 4 Mar 2022 05:09:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzZj2hMwXeUaq1Gur1yyxAVPawwHv3X6MmYT4StFgzasByxYCtLus5qFyRD0Wc4IMdPGNC X-Received: by 2002:a17:907:7baa:b0:6da:8ab8:fd1a with SMTP id ne42-20020a1709077baa00b006da8ab8fd1amr6918639ejc.192.1646399342678; Fri, 04 Mar 2022 05:09:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646399342; cv=none; d=google.com; s=arc-20160816; b=k9KHlEKVO9tB+NmDh81U2dBeVejHLs9BtZZu/L/xH7DbGgD5l+LioFrWTB3vhjApcj JxuhXphQgz1soE3Iry9wbC9oZ6pXajmBy7E42h3KFpDyxIuIXcy92fn9QE4ohpURPUit YcXuVonpiaJw/oge6OrtKXWr5vMenI9zTZ0aLrM+ojOC5NHymuRU/fHMEDnGGNudgiV2 NuE0v2NWJkYbLxlkIyXQDd35C7xEd0Z/GKA5kiAPE4Q8RpKk9sji5eUq6CCBpILqOZiI 0RU43A9A+5EJSfE3zpLqZ8BrXY0HSRnNE0MZPC4T5flijWh4pQNRmYBeZ0Vds11/daCH CrcA== 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=QLjmbSVlGlFETQCUxYirOVecnAYVQdqybBw1z3Za5Y0=; b=VX7zK420klwBPDpCURMHl0sMyqjIyydtbN4NcGNQqLa5b3JxaaIvax8IBRIPK40nk7 JvcqXthP4dvx1lWt9x9OZJTnNXnZnHDu3OJet4krw655LlGmo+6bQvNmK/HNVo1KxpeS AVLrZmyIDCyhSp796SDjRtysX9Cu34FOL7tbdbNuVpST63WOrOgH4Mg0lyo74eDW1Gcg nrhFWfQhxPQ4Ma2lUeq8yHlzANhQy33XbPqzEvnuXaWi+5+b+a3hC+ccQhvA9ZHHSXJl XYGBh84KHZywF99BH/lpppqtoPVJy74HwpGYkR55ssH6HcUqLnSAxtbD+s1FLL7V8tC7 Rmbw== 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 h24-20020a170906399800b006d1ad1eea41si2792795eje.423.2022.03.04.05.08.29; Fri, 04 Mar 2022 05:09:02 -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 S238484AbiCDGrg (ORCPT + 99 others); Fri, 4 Mar 2022 01:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbiCDGrd (ORCPT ); Fri, 4 Mar 2022 01:47:33 -0500 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C657218CC21; Thu, 3 Mar 2022 22:46:45 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-05 (Coremail) with SMTP id zQCowADHqPHQtSFiSwAcAg--.15700S2; Fri, 04 Mar 2022 14:46:41 +0800 (CST) From: Jiasheng Jiang To: broonie@kernel.org, michal.simek@xilinx.com Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] spi: spi-zynq-qspi: Handle error for clk_enable Date: Fri, 4 Mar 2022 14:46:39 +0800 Message-Id: <20220304064639.416690-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowADHqPHQtSFiSwAcAg--.15700S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xr47tF17AF47CryxZr1rtFb_yoWkGrg_Ca 17XrZIqrs8uw4xCF1xtr4DAFyUurs5Xr12q3Wvqay3trZxJrnFqrWDZrWUJ34fZw1UCrs3 Cr429340yr43CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbzxFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x02 67AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbrMaUUUUUU== X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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_enable(), it should be better to check it and return error if fails. Fixes: 67dca5e580f1 ("spi: spi-mem: Add support for Zynq QSPI controller") Signed-off-by: Jiasheng Jiang --- drivers/spi/spi-zynq-qspi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c index 78f31b61a2aa..77ea6b522348 100644 --- a/drivers/spi/spi-zynq-qspi.c +++ b/drivers/spi/spi-zynq-qspi.c @@ -379,12 +379,21 @@ static int zynq_qspi_setup_op(struct spi_device *spi) { struct spi_controller *ctlr = spi->master; struct zynq_qspi *qspi = spi_controller_get_devdata(ctlr); + int ret; if (ctlr->busy) return -EBUSY; - clk_enable(qspi->refclk); - clk_enable(qspi->pclk); + ret = clk_enable(qspi->refclk); + if (ret) + return ret; + + ret = clk_enable(qspi->pclk); + if (ret) { + clk_disable(qspi->refclk); + return ret; + } + zynq_qspi_write(qspi, ZYNQ_QSPI_ENABLE_OFFSET, ZYNQ_QSPI_ENABLE_ENABLE_MASK); -- 2.25.1