Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp232049pxx; Wed, 28 Oct 2020 03:34:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCffdZqJ0hqR3DDEDjUj+CQsXDIBPl6ydJDoI8uMpxHzZK3RDDAhMlgv20WFM3cdMKwkqA X-Received: by 2002:a50:f156:: with SMTP id z22mr7052280edl.94.1603881254001; Wed, 28 Oct 2020 03:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881253; cv=none; d=google.com; s=arc-20160816; b=x32a9kVnET+bbVD9uHzeL3qYVVbifVAAbEOARrGjv6w3Ee6IiO0kaJml7QUill/QeO XDU4CJr8hswyG/cSKyt6Fj15CwegltUIkJFC8G/hArKHIMjqp5GCmhaOVCjQAl2D3cqw sW7BpKT7ZDQFmbxKD+Q4nDHP/9Mr0jCbdVgEi1NaRbFhFd8rm0ob3VCKp0BkS1g7/8HW PynpCLQvf4sh/UwAg6S79axehGfhUjsV+nKmvbdVBZ+LagfPU1pu804omuvjzzwDlHNI zkuIquHu5ZQXaQEYTxXEN9nKIXu+jcYZfCiZPu1xegSHKgrewODUVYI9M13uU9ZQ6lNf t2DQ== 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=RqOcbjnheacZoMQoRzdoA3VX5s0lpHufa+Mp2BxniZs=; b=SDhDYKzkCCJqip+1wucs2ZcEIgkHI28P+e7FdmW+NYDyV0/tSeORWOh4X8HUsWzQO/ Vl6OZi5QYurUtf4YRJq2JVvIbmm4YbSn8PwKHqioCiGI+SvsoBYfrmH1+BiCSh3wW7TJ Aan+h3EhlJEa+eA4Fb1WGRggCQBBA5GbBvYTWmruKP18c28jFvKA7J26WV8O0wFcRKDU S41atVRMoYDPjxDcEN6fohigAYnj+P7wHTLMZnZgLfnarW9o34Yl94X2Oi9I8XU/FHUN X54TOuQP0hy2oqqr+GuWrNvFX4/8s23mL0F+kO7ZiEU4oMm8DMb7ZZoYKIRVYCozNa8z Xofw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UqySKs8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si2897729edy.300.2020.10.28.03.33.51; Wed, 28 Oct 2020 03:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=default header.b=UqySKs8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762564AbgJ0On1 (ORCPT + 99 others); Tue, 27 Oct 2020 10:43:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387822AbgJ0Oks (ORCPT ); Tue, 27 Oct 2020 10:40:48 -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 B3A2D21D7B; Tue, 27 Oct 2020 14:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809648; bh=Cx0OInTLJUkoZEKgnryxjtDkxgX4JVSHcSMcLYj6UTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqySKs8eZCaznAnvs74HWuKSvN06Xwa3PkBFcCtu7OD+ZpRs1UHR+cJ/Smip7vLk0 wnAp6tFHpwdS2OlCmQglU3L/FFwUnslIpIJcypnP+L5pPWRclF45+CU+9WBkOilfoE tiRcL8DdJOGYUHAtuGJO0hA4G6PAm0xE6ByajcBE= 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.4 270/408] clk: rockchip: Initialize hw to error to avoid undefined behavior Date: Tue, 27 Oct 2020 14:53:28 +0100 Message-Id: <20201027135507.570926404@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 ba9f00dc9740c..7dd2e0b1a5866 100644 --- a/drivers/clk/rockchip/clk-half-divider.c +++ b/drivers/clk/rockchip/clk-half-divider.c @@ -167,7 +167,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; -- 2.25.1