Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2202223iof; Tue, 7 Jun 2022 23:04:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyufQ1uEtyAVwlckrws2SkiBeCozosILqSsjgRveD//Z7dMJX1TlMFPC8PWPoxhsEoDq7gW X-Received: by 2002:a17:902:cec2:b0:166:4e45:e1b2 with SMTP id d2-20020a170902cec200b001664e45e1b2mr27964042plg.73.1654668271827; Tue, 07 Jun 2022 23:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668271; cv=none; d=google.com; s=arc-20160816; b=BPrPDcOveDpZM6QAr4XhBHkx+cKz2crowasXEp4r3YczQP7VXAenkWMpFf7PwyeO+n g4NcqrvPkT+vPkm4GhACwr++E6ltS8tQLNNMQhA+9i61v1+GUbU6P8dIvSTRrZF5MrpC CMaSjNe/AJrAHouBXuYwaiqW53aFPu6J8+9EOwl3SNhBxgca4Jvfga0p2GRl3Lbilw+m mPI9jpiMruqeC+wCPRNQ3fE8FZOJwK51cBnqPahfpdF9yT9kasz4FGXXh79AsqFlKwG1 0YmmZ/fPCoKZkCskiHDoKOJ/naesSyBkOFdQXRlwLM17pVM5RwfAtj7JTjldtk/l7MEH SGng== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rxY2BC4Jxv69/keSxovypejQ+jwle7yl65bP4tcPvdo=; b=ttufJhM4sUUfid5OliqYmj9oyUAeXtKN2FZHrj30ytJgixY4aqqLaipQJ6vYmMe1/V WDOuwvNNPtnl6Sh9yFJBfvuzGL8Bf3yWEFBQnyVWjnVQXd2/w60xLdrzBCQvUY3bfRaG C7OaMMc1k7kJfpmvvVIi3A2aE/gWuOPTFTWV4dqJT5mgvWBxzXVwW+vtitt83NAT1Ric dUjrpuzkgqvlnAKCBacYHGUYh0At4U1pKGdEUoQBRGACnSze62sLACsaro4tt5CjmYbo VN8M59ZH/DIg4LvNLJ59mlcNeHsQLakBRR/sSQuZ+yKAE/erYhoQfitKSvw8Ri6S/2m+ fMlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ng25k4vZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m189-20020a633fc6000000b003fc6a2458b6si14096756pga.350.2022.06.07.23.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:04:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ng25k4vZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 24B1E81995; Tue, 7 Jun 2022 22:28:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387378AbiFHB1W (ORCPT + 99 others); Tue, 7 Jun 2022 21:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383478AbiFGVxO (ORCPT ); Tue, 7 Jun 2022 17:53:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3937244F66; Tue, 7 Jun 2022 12:11:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD8CE612EC; Tue, 7 Jun 2022 19:11:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADE0C385A5; Tue, 7 Jun 2022 19:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629108; bh=yRHFUJLE9xSqVhgzgjZ7u51QhzkbKY04Y0WQF2bXGUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ng25k4vZ/GLk4VY8JDxERco6Av8wEzNSqPjpguIn6JZpgcliwM5uFXk6KEl5qZCUu wdfOPCCzcU2Nr6wUQGHd+lExvjWic6GCWlILhBAQ562IC1H9fXdMriZZmtdeeUXbJE B47dlZETzIfO+P8HJP1naZ5fj0hyJmjApjDzbCXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladis Dronov , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 572/879] hwrng: cn10k - Make check_rng_health() return an error code Date: Tue, 7 Jun 2022 19:01:30 +0200 Message-Id: <20220607165019.458060752@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Vladis Dronov [ Upstream commit 32547a6aedda132907fcd15cdc8271429609f216 ] Currently check_rng_health() returns zero unconditionally. Make it to output an error code and return it. Fixes: 38e9791a0209 ("hwrng: cn10k - Add random number generator support") Signed-off-by: Vladis Dronov Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/cn10k-rng.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c index dd226630b67d..a01e9307737c 100644 --- a/drivers/char/hw_random/cn10k-rng.c +++ b/drivers/char/hw_random/cn10k-rng.c @@ -31,26 +31,23 @@ struct cn10k_rng { #define PLAT_OCTEONTX_RESET_RNG_EBG_HEALTH_STATE 0xc2000b0f -static int reset_rng_health_state(struct cn10k_rng *rng) +static unsigned long reset_rng_health_state(struct cn10k_rng *rng) { struct arm_smccc_res res; /* Send SMC service call to reset EBG health state */ arm_smccc_smc(PLAT_OCTEONTX_RESET_RNG_EBG_HEALTH_STATE, 0, 0, 0, 0, 0, 0, 0, &res); - if (res.a0 != 0UL) - return -EIO; - - return 0; + return res.a0; } static int check_rng_health(struct cn10k_rng *rng) { u64 status; - int err; + unsigned long err; /* Skip checking health */ if (!rng->reg_base) - return 0; + return -ENODEV; status = readq(rng->reg_base + RNM_PF_EBG_HEALTH); if (status & BIT_ULL(20)) { @@ -58,7 +55,9 @@ static int check_rng_health(struct cn10k_rng *rng) if (err) { dev_err(&rng->pdev->dev, "HWRNG: Health test failed (status=%llx)\n", status); - dev_err(&rng->pdev->dev, "HWRNG: error during reset\n"); + dev_err(&rng->pdev->dev, "HWRNG: error during reset (error=%lx)\n", + err); + return -EIO; } } return 0; -- 2.35.1