From patchwork Thu Jun 15 14:49:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 108585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp720737vqr; Thu, 15 Jun 2023 08:27:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53qrQaoJMppLiWcfwETACSFzZBGaLU2gQl5xPPh7Eb/fwU3MKuCJUtnVapsDxqdeLgcicc X-Received: by 2002:a05:6a20:3cab:b0:114:dd7d:ce0c with SMTP id b43-20020a056a203cab00b00114dd7dce0cmr5085574pzj.48.1686842878675; Thu, 15 Jun 2023 08:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686842878; cv=none; d=google.com; s=arc-20160816; b=yZSS/LysFwEll3NsKZjRSQmhvWt9UvzhTnibVbBORF1gFv/fhj9Rj6g+9AiP0faolB J+rwNH/sd3U+abWEs8V4EdhBCUBTpqoSKGdIsmBn9CE/4KbAQaT88VbBb9yiEOtgL3Wi rSw5ZsJcjtRIPPDFY2aN/wL9md7FSsULSoxwsg+ZgVSa3zgkbVairgcvvtbkl9ZPItOB YHDorJ1JKqCPCA6s1NffYDj4vHidTVvUD/0hElPB1Qcsnfv+9+0Md6xAsI8sbhrCHFuf Ud7hpwHr5umW5vOtevqalO/OwVFz3L9NaT0TUBHJe7esuwlfBIybJ5Ou7T3zqqENbPpj 66yA== 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=Ea/BpRwq54pqFFL7kXcDQKvZv06g1pJk8zcoQv5W5Xw=; b=S/IQuN8jXdzNryAj7feVjUfaIzpqyZAz+mzOTzJTHZ2/StwgG2uASFrMAthYvrTlmN UCL4hsrwzLJKf0yy4vUwVCtZAVLY1PbZfQBtxE5AdV1jXaYWnvudyK8siPxu2wyhPKOS 11JY4C9Jj7Fk7n6NaP0ewhi1KrwvKIAtjsdLEszlQco1Cl5anUp1UwUKxaUpx95bHLPy vFkVIBAGQ49jDz0w6JDcsrML40SjGq3wJ0ANZhSuQ5qsjRiE6iCyIdaER2soDWgWRdiR QrZ1cI+Kcf9Gc1aphV9vzQDQ4s96v4AuAU/W9RdZ2IufvMO1bx7FhSESYGDd3S6ZBBre Dx4A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u69-20020a638548000000b0054fe3b04577si2463183pgd.750.2023.06.15.08.27.46; Thu, 15 Jun 2023 08:27:58 -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; 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 S1345117AbjFOOvp (ORCPT + 99 others); Thu, 15 Jun 2023 10:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245570AbjFOOvi (ORCPT ); Thu, 15 Jun 2023 10:51:38 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26209273D; Thu, 15 Jun 2023 07:51:36 -0700 (PDT) Received: from [94.118.13.74] (helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1q9oJx-0001fB-Iw; Thu, 15 Jun 2023 16:51:33 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser , stable@vger.kernel.org Subject: [PATCH] hwrng: imx-rngc - fix the timeout for init and self check Date: Thu, 15 Jun 2023 15:49:59 +0100 Message-Id: <20230615144959.1171085-1-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768782958229022906?= X-GMAIL-MSGID: =?utf-8?q?1768782958229022906?= Fix the timeout that is used for the initialisation and for the self test. wait_for_completion_timeout expects a timeout in jiffies, but RNGC_TIMEOUT is in milliseconds. Call msecs_to_jiffies to do the conversion. Cc: stable@vger.kernel.org Fixes: 1d5449445bd0 ("hwrng: mx-rngc - add a driver for Freescale RNGC") Signed-off-by: Martin Kaiser --- drivers/char/hw_random/imx-rngc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index 1a6a5dd0a5a1..e5a9dee615c8 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -110,7 +110,7 @@ static int imx_rngc_self_test(struct imx_rngc *rngc) cmd = readl(rngc->base + RNGC_COMMAND); writel(cmd | RNGC_CMD_SELF_TEST, rngc->base + RNGC_COMMAND); - ret = wait_for_completion_timeout(&rngc->rng_op_done, RNGC_TIMEOUT); + ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT)); imx_rngc_irq_mask_clear(rngc); if (!ret) return -ETIMEDOUT; @@ -182,9 +182,7 @@ static int imx_rngc_init(struct hwrng *rng) cmd = readl(rngc->base + RNGC_COMMAND); writel(cmd | RNGC_CMD_SEED, rngc->base + RNGC_COMMAND); - ret = wait_for_completion_timeout(&rngc->rng_op_done, - RNGC_TIMEOUT); - + ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT)); if (!ret) { ret = -ETIMEDOUT; goto err;