Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3172947lqo; Wed, 15 May 2024 01:41:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVEsxWn25EojMCBy+3m0Y++P0UAwMGWGF06XEyw6nbTg3B1ryQ6nwActIN+/xgeIxPMdpaMIHZZaAjWf0RcW6B6pLH5t9eEt9Mp+NmFMQ== X-Google-Smtp-Source: AGHT+IEiyN4Y6M1c4HGbaOUgAlQnUIRcxgmnorEfV4bY+5x9+qk7dmOcHKT3p4PyKUPnfkbfsZ5G X-Received: by 2002:ac8:5906:0:b0:43d:f57f:3ebb with SMTP id d75a77b69052e-43dfdb69408mr191613701cf.55.1715762499171; Wed, 15 May 2024 01:41:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715762499; cv=pass; d=google.com; s=arc-20160816; b=1LfWiQtFHCfT1iyaHVZhuBWiRvmlaHPEDamuY8uhY/7E7Rvq4SMmfAB6oxgkttYtF6 JUKk78NRJ4JeTGMG6ek1WzhxeyhnNSmUgAQ6FQDxDzme5y5CKaPbVfTFjrbV0EAS7YP+ /I2QQanMvncgyzFOCLMR/Ww86ZxEsz3vt0Kp5EhrsYdnoYPTKHbDO1uv3ztlavlKzXXN /xYzsVZQLsjyqLdfzXEI0f3JeJmI4rqTlRQZFmdK3yjGujxJWxnfydgZesxy7sDvmgPL +btsL4zpDXuifQBqFyGZ9w5axy93MdHq9MLsCFMdwbx8NscfWmGAM8SJMB1skh0bfLiH 7fqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=A9hDPAFZQ8VR7Ymsks9oGMAsjV0sF3O6eQfZxQA/W+w=; fh=O7DFhWdBJWH7yUMkQvhRlcu5JlaKzaP7XRUoBGiylEI=; b=lA95G5vLX1jUoyMSoh6Gi8FKpsPaN9NbrPHwEMxnN6TPdrLroG5Mq0vL07YuHoX3sO DLBVMz79Ck0QuLm9+gOGN9xVB0KbHc+SpuJ1EQgcvXDldYxnOeRnqf6k7xqjCsH8cGfj jjI0HpY7/HyvincIf2eCqB/2c0lyyJgQRSBWKqH5xdBaTOvyltTs1ZsJ7AlhYHFUfNfN GcGBWVltA/FFbtPZufobEFkxL2yRtPTqSR5PWJEaVxYev6HFuoOOLYX+oG/HyvdxkJ6N 807tgRyDWzPoLEnbSv+y7ZTEvd5wt/uR+MCk6C8XsJAVvLNcjBf/Fgi5ALs7C4cd5jBD rdhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-179663-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179663-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df56bc3e4si140425891cf.603.2024.05.15.01.41.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 01:41:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179663-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-179663-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179663-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B1AEE1C2232F for ; Wed, 15 May 2024 08:41:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AEBF4F606; Wed, 15 May 2024 08:41:29 +0000 (UTC) Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CD224DA15; Wed, 15 May 2024 08:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715762488; cv=none; b=lSI+z3Ru4fYoJJePT4bhA8UbT4mmYEkFOWEkZarPycfW/XIMMBU/ayYxXZ/VeU6+g++v46NupNZt84n4ms8spMQh4aJF0voH5+tasTRqqZOCySlBDUtjDuKEHxmimioepfXcOI+003K2K+FQ0CRmIyEtHJiXeUVGkyocVSUSb2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715762488; c=relaxed/simple; bh=8L6MR+XjIcweRFqdxmO8XAW2pW64tx8lIak3KbvXdGk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eMKIhRh/1osfE1i/zDGAiNmoSL7eyVFOtVCzi8iIwb6GJPd9dpUIqIjQPVu5WJdyQJPTmP7vZ1b8yqCL4BfMt2lBBj4KFIB7JpNJnJ65zWY2vVZ1L9dz98c6WewdaiJJDKjYTUtPAdleyTPcwWBOvAxiniwpSUBkPGaVzr260r0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost (unknown [124.16.138.129]) by APP-05 (Coremail) with SMTP id zQCowAAnLwMWdURma6dPCw--.60167S2; Wed, 15 May 2024 16:40:55 +0800 (CST) From: Chen Ni To: broonie@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chen Ni Subject: [PATCH] spi: atmel-quadspi: Add missing check for clk_prepare Date: Wed, 15 May 2024 16:40:28 +0800 Message-Id: <20240515084028.3210406-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:zQCowAAnLwMWdURma6dPCw--.60167S2 X-Coremail-Antispam: 1UD129KBjvdXoWrtF4xtryfJw4kXw13XF47Jwb_yoWfKFX_CF WDu3sxGr43Gr4DK3Waqw1UZr9a9FWUZayI9F1qv3WfJFyDJry3uryUZF1DC3yUZr4Ikw13 CF1UG3Z2yrnxZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbz8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E 14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ Add check for the return value of clk_prepare() and return the error if it fails in order to catch the error. Fixes: 4a2f83b7f780 ("spi: atmel-quadspi: add runtime pm support") Signed-off-by: Chen Ni --- drivers/spi/atmel-quadspi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 370c4d1572ed..5aaff3bee1b7 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -756,8 +756,15 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev) struct atmel_qspi *aq = spi_controller_get_devdata(ctrl); int ret; - clk_prepare(aq->pclk); - clk_prepare(aq->qspick); + ret = clk_prepare(aq->pclk); + if (ret) + return ret; + + ret = clk_prepare(aq->qspick); + if (ret) { + clk_unprepare(aq->pclk); + return ret; + } ret = pm_runtime_force_resume(dev); if (ret < 0) -- 2.25.1