Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4303745pxb; Sat, 5 Feb 2022 09:17:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX5Ktzquqe8cEyox9eOa1QG+2FH9z+U3U2uWJk7fYs+/t8ZuTQJY8EC0oZtewbDKU7QFFS X-Received: by 2002:a17:906:1611:: with SMTP id m17mr3736281ejd.443.1644081441510; Sat, 05 Feb 2022 09:17:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644081441; cv=none; d=google.com; s=arc-20160816; b=BjeNnNzvpW/1lUfFtSpH8C7jl6OeCrhW+YbRIV8IqEEKc0eAz+eZ34ePoGukSwIFai vEBmPsPVVy47pBm4KiHyCDp4nNyU9j3yJ3r3+4OMLM+otn1U3ddFFKCfW6krEiiexWO9 AhoFEhu6pZsHaOCOwXySwmEEi9rbk8wI9RCuw6RHxw2PipCq/oy1ZGANfW2m0xJ9BzOk CTZmCXAFc98LJjTZkjfA/SG91Y9GHwuVyeaqpCRRtJoVIgyJ7N+F4ZEiaeShAcjNPVOZ +6x8n0YupJSIqyl6FDB6KkhHZV8jZyrogMGdcJKBBICWR2nMn7TYYQjzdk2Wz9R0+mFw HeTw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=713HQL5x//o/KghlUsgMrDORBx+gP5N718ebtgS9CfI=; b=buJnVpsYJ3pxuHelqB7Rc91Vyxt08+YzeMZF9ueCXKmV4Wo886cJDX12ZXlmyYaJH7 5CIbTN+vx23/8Htf3aCgSlZNiLO02okSsv9C4JKXF+mN5cPZqqV2ZSdUNP/B8I8wTzpR b3rTPUcDKrO7woFYYz5LJIji0LsbEJBc7hAIMghExbLAwapSTlNFeXnaTRQkpYsiL16s 8k+WZ5fvuu4rHO95GxTlEB1Z/aPaR4lwc6kjTro3xPrvFyJ6ElxJUSduOmeSOGiAE9hC ZLG0NpnjzPQwVErn6JKaRChebKtcTn6ln3/vxB8wCADjgMrc6PcKfn1kiQKI+M37FCDs nqng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BHMqirob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13si4726028edc.173.2022.02.05.09.16.55; Sat, 05 Feb 2022 09:17:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BHMqirob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380273AbiBEPAZ (ORCPT + 99 others); Sat, 5 Feb 2022 10:00:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49053 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380259AbiBEPAV (ORCPT ); Sat, 5 Feb 2022 10:00:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644073220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=713HQL5x//o/KghlUsgMrDORBx+gP5N718ebtgS9CfI=; b=BHMqirobupL0qHDUTGS18gG/t9A4jYcSlEaeKbyzeCtAq23Gh7dDu7Pa5zjjT9+f1Dq6ZE ruanLcTCOLDyDr+f5JO/7aIYEHY2s3SoaEYRJgTUermajXf7L47ixRog9PjToG3QrHP+4l doB0RrTEXYu5mVjYOEj8EDRzKH72OpM= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-Cq78lpotPN2_ZK8V0EQG8g-1; Sat, 05 Feb 2022 10:00:19 -0500 X-MC-Unique: Cq78lpotPN2_ZK8V0EQG8g-1 Received: by mail-qt1-f199.google.com with SMTP id a6-20020ac844a6000000b002cf3968d32aso7218330qto.1 for ; Sat, 05 Feb 2022 07:00:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=713HQL5x//o/KghlUsgMrDORBx+gP5N718ebtgS9CfI=; b=Kf9iI2aGFJuD9WvxyQkepZO1pSTdmvxv5AM8oSQ2bCnj3ICVbZYyieT983/d0PHXFr KZLs1K76+UUh9lM00bvMyYCt23Mo3ugfdVD363B2IIkMlZaAL780xAhl8ZaiwChVtc6B jT7mzby2hZci/wbPduOqTFT3M346bOjWgJOm6/xNqYiGpgVzc3SiplSu/HnozORBGp8U UAD8XPsh3ItaudLgBkMZ6OMXsWQqNQ4NjWbY7pkxVMYQWpxLzHHBg+6e4VIy20E55dAW BYimpiyupBoqzaj7IX2PtW8MR8y9lBD9Bgn1JS5DL1OQ4XLkWLcOhN1l/Dec7GWbCdEP rZtg== X-Gm-Message-State: AOAM532zJ6/2LhCiPIygYKY71GGr2OZO//wxpwDD/QY5Ui4nbf93o8Iy i0a1HqKidyk4gjlCbizMGm77uaoC0llbaod36Ejrs9VMQauok1Pl1EuTrazBtllOrS2IY2rh/XL 8e9gnoqbUcN3+ZiPClhwL31Ju X-Received: by 2002:a05:620a:371d:: with SMTP id de29mr2218861qkb.300.1644073219112; Sat, 05 Feb 2022 07:00:19 -0800 (PST) X-Received: by 2002:a05:620a:371d:: with SMTP id de29mr2218834qkb.300.1644073218865; Sat, 05 Feb 2022 07:00:18 -0800 (PST) Received: from localhost.localdomain.com (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id d22sm2657159qkn.112.2022.02.05.07.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Feb 2022 07:00:17 -0800 (PST) From: trix@redhat.com To: evan.quan@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com, lijo.lazar@amd.com, darren.powell@amd.com, guchun.chen@amd.com, andrey.grodzovsky@amd.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Tom Rix Subject: [PATCH] drm/amd/pm: fix error handling Date: Sat, 5 Feb 2022 07:00:08 -0800 Message-Id: <20220205150008.1968218-1-trix@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix clang static analysis reports this error amdgpu_smu.c:2289:9: warning: Called function pointer is null (null dereference) return smu->ppt_funcs->emit_clk_levels( ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There is a logic error in the earlier check of emit_clk_levels. The error value is set to the ret variable but ret is never used. Return directly and remove the unneeded ret variable. Fixes: 5d64f9bbb628 ("amdgpu/pm: Implement new API function "emit" that accepts buffer base and write offset") Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index af368aa1fd0ae..5f3b3745a9b7a 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -2274,7 +2274,6 @@ static int smu_emit_ppclk_levels(void *handle, enum pp_clock_type type, char *bu { struct smu_context *smu = handle; enum smu_clk_type clk_type; - int ret = 0; clk_type = smu_convert_to_smuclk(type); if (clk_type == SMU_CLK_COUNT) @@ -2284,7 +2283,7 @@ static int smu_emit_ppclk_levels(void *handle, enum pp_clock_type type, char *bu return -EOPNOTSUPP; if (!smu->ppt_funcs->emit_clk_levels) - ret = -ENOENT; + return -ENOENT; return smu->ppt_funcs->emit_clk_levels(smu, clk_type, buf, offset); -- 2.26.3