From patchwork Tue Oct 27 13:53:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 307302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A9DC5DF9E for ; Tue, 27 Oct 2020 16:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 161E320727 for ; Tue, 27 Oct 2020 16:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603817028; bh=mcHk6piw7br4qc/6ajvRIGsdzwYRhDh1bfnKcN2vjPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=a30XfmugbqRMaTXdPcDW9qE/G/aF2OI1di/dfAIFRmAmJNujvEwdGklRKV0061lNC TqlYuscf5+RTSEo2mO6vqSIE7oNqbeJg5elkFOtz7ZDIHgSt16LiAtdBT64tbgyWLl q2nd2b4W2UO/bP1AR66E/XeSMOHY5Nro+vtpPviQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1802395AbgJ0Qg3 (ORCPT ); Tue, 27 Oct 2020 12:36:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:35964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1799944AbgJ0Pn1 (ORCPT ); Tue, 27 Oct 2020 11:43:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 79C6322409; Tue, 27 Oct 2020 15:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813405; bh=mcHk6piw7br4qc/6ajvRIGsdzwYRhDh1bfnKcN2vjPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DekM1coz5mOZEq0X08NmxeVvTfm0I7DQYIcqj4tR0ldh71BZenzoJWj4bP+VEuXE8 pk6Ltk9oD0RsnBOHyp7P+ZB4XDtpEjo+KUK/GqC/hiAQ0XeFfaZGWmpgu6av5fB/Jn oDCQLJ3vENs7hrMxsV7uxsSuURrnpPsVAA3B2hjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Elaine Zhang , Heiko Stuebner , Stephen Boyd , Sasha Levin Subject: [PATCH 5.9 539/757] clk: rockchip: Initialize hw to error to avoid undefined behavior Date: Tue, 27 Oct 2020 14:53:09 +0100 Message-Id: <20201027135515.768201818@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stephen Boyd [ Upstream commit b608f11d49ec671739604cc763248d8e8fadbbeb ] We can get down to this return value from ERR_CAST() without initializing hw. Set it to -ENOMEM so that we always return something sane. Fixes the following smatch warning: drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() error: uninitialized symbol 'hw'. drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() warn: passing zero to 'ERR_CAST' Cc: Elaine Zhang Cc: Heiko Stuebner Fixes: 956060a52795 ("clk: rockchip: add support for half divider") Reviewed-by: Heiko Stuebner Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/rockchip/clk-half-divider.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c index b333fc28c94b6..37c858d689e0d 100644 --- a/drivers/clk/rockchip/clk-half-divider.c +++ b/drivers/clk/rockchip/clk-half-divider.c @@ -166,7 +166,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, unsigned long flags, spinlock_t *lock) { - struct clk *clk; + struct clk *clk = ERR_PTR(-ENOMEM); struct clk_mux *mux = NULL; struct clk_gate *gate = NULL; struct clk_divider *div = NULL;