Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp255823pxb; Mon, 8 Feb 2021 22:28:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaRAKHYSrB42j6WEY+Ufr4JjJPJaJuNnlob4MK30MMjJxbM9a0ZE7ADdaNeMmPbouPmyi6 X-Received: by 2002:a17:906:fcb5:: with SMTP id qw21mr20710714ejb.391.1612852089240; Mon, 08 Feb 2021 22:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612852089; cv=none; d=google.com; s=arc-20160816; b=LGpJJPbZNUVXs5EDYU6S3p0hO+gD3yK0btKxUwyQwS1zJg97ZXYakzYRA3o7e8x3af MFNHxRbXlVCqU0cVPBVU6Qz7mWOS+zDFN9/1M+kvze5Z82EntaWzAjwfLE1h7QZol9ie OmUM9sH41o2o7ULSO/ObPGnmoPO6DHwa4Av3rnO50IheF68h6IgYA54LR4Bg7OtrfBLp D0SOfU/1lixDJDAVtEDHVSSwKZB9fBvg5DeNtpztQb6o5+EMzQIF+QmPB5xcaq04Chn/ HTqXqTFdnjktzVZAbHrAgyvSKZGn24EmvFkrmZ0OhunMDip1HNUgL9eLJotyhEM/kdmN R8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=OLNxWnkXm9uMUfxkflLJUMsCDqx7uHlXGqYULpXyT5c=; b=gSXOb0gsFpaeqHXGo/bY54iwvbwoLjDz1Az/SS6FfdV698HqS97EUucB3lMlRiS6ll RILGEkbfqvBXj5parmj3Xh9hIF9P4KTe8Mew6+94GJTAtQB1VbjSJ9FAdHV4fbTy9ApF +vUmbAb2jrHnFRh6QzKYOWbh2r6F4Mfntw/i4TwldrXnF8IZ3B4ssoyKoVDxRrXYDWj/ A6Qhn0W1tH2Dxf72q/jri0XrEp8UUzm+crtHVerduVLjLthG4/9miNhEKCYt+2GG0TuE gJ+0ICcWg5nLors8EYhK8fWshShWZr5umHHrIkGHjZYr4dOAy7Qa/6heIvRF2cNdGZHg 2Olg== ARC-Authentication-Results: i=1; mx.google.com; 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 eb13si15547517edb.385.2021.02.08.22.27.39; Mon, 08 Feb 2021 22:28:09 -0800 (PST) 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; 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 S230301AbhBIG0i (ORCPT + 99 others); Tue, 9 Feb 2021 01:26:38 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:12532 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbhBIG0V (ORCPT ); Tue, 9 Feb 2021 01:26:21 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DZXsP2GrnzMWrY; Tue, 9 Feb 2021 14:23:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 14:25:35 +0800 From: Tian Tao To: , , , CC: , , Subject: [PATCH] hwrng: bcm2835 - remove redundant null check Date: Tue, 9 Feb 2021 14:25:11 +0800 Message-ID: <1612851911-57937-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org clk_prepare_enable() and clk_disable_unprepare() will check NULL clock parameter, so It is not necessary to add additional checks. Signed-off-by: Tian Tao --- drivers/char/hw_random/bcm2835-rng.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c index 1a7c43b..ed0aa51 100644 --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c @@ -88,11 +88,9 @@ static int bcm2835_rng_init(struct hwrng *rng) int ret = 0; u32 val; - if (!IS_ERR(priv->clk)) { - ret = clk_prepare_enable(priv->clk); - if (ret) - return ret; - } + ret = clk_prepare_enable(priv->clk); + if (ret) + return ret; if (priv->mask_interrupts) { /* mask the interrupt */ @@ -115,8 +113,7 @@ static void bcm2835_rng_cleanup(struct hwrng *rng) /* disable rng hardware */ rng_writel(priv, 0, RNG_CTRL); - if (!IS_ERR(priv->clk)) - clk_disable_unprepare(priv->clk); + clk_disable_unprepare(priv->clk); } struct bcm2835_rng_of_data { -- 2.7.4