Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1151253ybh; Thu, 23 Jul 2020 01:31:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXvMT/mNcipQ5r+IJPcDxK7lzHvr5anaRRjJzBlZuyv7eSJWeqYPfTVGZ1l9VcS1zb4jG8 X-Received: by 2002:a17:906:178b:: with SMTP id t11mr3169245eje.489.1595493097750; Thu, 23 Jul 2020 01:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595493097; cv=none; d=google.com; s=arc-20160816; b=TwLS1ADw8O3G2ufD58CDzrwESfdpHXqdpB7PO/UK01qjjKV6etsAQdCjYuz8CNbdL7 CwHcZxRVAfhl4LeTiOe09UOB9T13NiTwJ1ilu2LBqI/gFwHpa4npAJ01MAvWysuqqbz1 KDyNKAbGYPbclOZ2OjpNsgq/qwK4fY8MUhhXgd6uQBuJTahercmTkEZ5aoYpnIwxu3oy GMoiojIcpXcscM0CJ8gcdObmQowL+uDU27kbQShDpWrjGn25PYLiaCF3JQ5ucy6PryUs 0+0qegxqIpq6Z1lioIgaVOi0YqAO1pgSjX7IFlLJ2BnyNt9D94Ci0YmBQ2U6HIptgwmB jXDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=QHOcU/AHWfp7cpU6Aga751e/Kq9YnV85ILpM7tybMLY=; b=EOqYuqG5KW6nd8iC5fHQqQu+OC7ndBGVjqD516ZbeTYB4+6qAZNaPy/sBPKxBR/zrq S52zDEtI51G0De3E9An3gi9fib0WS+L+5LilVRshp/PlFKR//PVVFmjwrSlDSfN5qhxH JkABuiSWJ1puggcWTOeCIQRqY8y4dCkvJysktdbU3BUpsMoUmOh3zqZaefiMsh0Exagu D8wuRttQ6sbXe/RABjFYC3hT6D9AOqNg06KUe2c3rXFF2c+6J8mbxcoWHIW5DqRHT6r7 y7bpaBP5MBL+yA7RC44IC2UnLjJPex84NcRRKNyoKg0JW2Wcv0bA490vwiZ/0RJkSFuY kg3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foundries-io.20150623.gappssmtp.com header.s=20150623 header.b=0xDSj1eC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si1546974ejz.319.2020.07.23.01.31.13; Thu, 23 Jul 2020 01:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@foundries-io.20150623.gappssmtp.com header.s=20150623 header.b=0xDSj1eC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727107AbgGWI21 (ORCPT + 99 others); Thu, 23 Jul 2020 04:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726975AbgGWI21 (ORCPT ); Thu, 23 Jul 2020 04:28:27 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A52AEC0619DC for ; Thu, 23 Jul 2020 01:28:26 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id f7so4308543wrw.1 for ; Thu, 23 Jul 2020 01:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=QHOcU/AHWfp7cpU6Aga751e/Kq9YnV85ILpM7tybMLY=; b=0xDSj1eCfkewU6SxDvs0V2R8p+CgnZDqvbz6mIc6P+gvyltTYobal9eWmYyUKMu3m9 1oTEWl86BtIkIvVFp5x0rwMtn0/MQEwJIDONcotfp0x1UNOAQ0xg8BXtAFmfIA8xMb7F 2J0uLIp9I/efzRWmoinDUuwWfl43ehWghPbAbh16vy1XaQDSAs24Uvnc1LX7I0Yhcb8Q oyBd6w2cvv7oNRlpKzd+b+XGpiNzAqsOZEYmZ7fPxKs+zTx4HylrNScZAVKDpL1KkYg4 NvLEvdVF7/ALg8x4DCLxKjy5u4j9ZiyvBpar3AkahGUvKWp8CppQ7O+H5FZzt2rhnAp9 PLEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QHOcU/AHWfp7cpU6Aga751e/Kq9YnV85ILpM7tybMLY=; b=ghsiDBj64gC48Qqj5nd//eETAb8K/Kl4o4oAnPnFY721MPGRhqevcV9MhSvlDC0XMG SQKozNb09deXBJjvWkY/4PZqFjocwen3xOJsi7Rn8nWbDHmjArN1XqCdpbyie92JSzJ4 ctYKALDd8QABE8jHNwvlAAjVrbXXWPKPxSwXOEpGtqIxAO2jnDb2cybRJfqVW1gS+AXP 5bRvD27DViERFFYvZccgAD3RwdcLuLlEodiQ5FfzLeC+Wr67z5DSrRSYQpccIVuNt6yx bvSSa8k5OAgo3M1qCnDn99BaKd40awj7lbm7Jj2AJLjJ+QA/OfqcroSVXvsvfrzwr4Hy CwZQ== X-Gm-Message-State: AOAM530ZFCEPXLy83u6tvh9il8m5RPCFMZb3g2BAQwO09SQNGWzLB9ts ueRHpJCPjT+R0MATMaSbeDR9DA== X-Received: by 2002:adf:edd0:: with SMTP id v16mr3229599wro.271.1595492905282; Thu, 23 Jul 2020 01:28:25 -0700 (PDT) Received: from localhost.localdomain (126.red-83-36-179.dynamicip.rima-tde.net. [83.36.179.126]) by smtp.gmail.com with ESMTPSA id o2sm2879094wrj.21.2020.07.23.01.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 01:28:24 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, sumit.garg@linaro.org, mpm@selenic.com, herbert@gondor.apana.org.au Cc: jens.wiklander@linaro.org, arnd@arndb.de, ricardo@foundries.io, mike@foundries.io, gregkh@linuxfoundation.org, op-tee@lists.trustedfirmware.org, linux-crypto@vger.kernel.org Subject: [PATCH 1/2] hwrng: optee: handle unlimited data rates Date: Thu, 23 Jul 2020 10:28:20 +0200 Message-Id: <20200723082821.26237-1-jorge@foundries.io> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Data rates of MAX_UINT32 will schedule an unnecessary one jiffy timeout on the call to msleep. Avoid this scenario by using 0 as the unlimited data rate. Signed-off-by: Jorge Ramirez-Ortiz --- drivers/char/hw_random/optee-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c index 49b2e02537dd..5bc4700c4dae 100644 --- a/drivers/char/hw_random/optee-rng.c +++ b/drivers/char/hw_random/optee-rng.c @@ -128,7 +128,7 @@ static int optee_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) data += rng_size; read += rng_size; - if (wait) { + if (wait && pvt_data->data_rate) { if (timeout-- == 0) return read; msleep((1000 * (max - read)) / pvt_data->data_rate); -- 2.17.1