Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2664295pxa; Mon, 17 Aug 2020 15:57:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGp0SZhu/tUzU3yL1JzKzsEUZujGSjmcuBlPEcdObaOGYllxtHJJbRH6nTm5FMTklBoPcc X-Received: by 2002:a17:906:16c8:: with SMTP id t8mr17037345ejd.484.1597705034702; Mon, 17 Aug 2020 15:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597705034; cv=none; d=google.com; s=arc-20160816; b=tcJPIzLBkCTFqzkOYiIHyWsK9ojzi8b4c1m0lQ3m+TCZ7iR3q7erXyOAUskxAEKaq4 caER26sJPPf0DwLPu6Uq9LGWiXdpxU8S3lSorpbx4itT2hoWqofsHZRUkr1bnvDa17iH Rh+/dxGxv6qVRk6Etgerhl7Z6dipleuacVDVe6R83PXuh6bUm4Pdp/AbRMOKiF3mqge1 Xw6zeB+fd1FMMOC97v7fDUJDe613VSSHtE9Xz9wEDWek6oSbpxGh6vcUD2PbS4RcJjgG gKRndCAK6I9ymUyarVP5/3VW6DX3cYHMmPZKxg+i7U1h6G03hnKAmURYNih8IH2P7yU3 L85w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a45OkhGUBW+nfaUwDLuz5QD/deSmk+XQvR9EPUPyz0M=; b=QJiJkC7aEoWrrLFowLG4jpY/2KPKPtl/dUCrylOMqoOA+wC6OaZ8cwhzoJkk/iKLA4 taBf64brWngBRVxRUtN0q8HeyDUiewEqf5+Yi4uD5XYYP9pVkSc9IW4pDRoGIs70FZiE brw08TJ+fW2cox0V8xFwernBWINjPzLnrj9Q90WI5hzfPJu4xFfAX8vZkEXu3qZ8rR3P PoHvg4B+TsofMBaw8JfRn5p095rxEW8O9w/F0WtoOr4Sw7Aaa3wsZGCCkMsY7G+7w3l3 ypMD47h9o0QfW1PEUGuuxEpQm6LrOCg9ihs1OgmKRTeRL+cAGJRUHgrM26H2lG5XSFxz 8AsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qkuf0c3z; 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 q12si11932912ejs.273.2020.08.17.15.56.51; Mon, 17 Aug 2020 15:57:14 -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=qkuf0c3z; 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 S2390462AbgHQTk6 (ORCPT + 99 others); Mon, 17 Aug 2020 15:40:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:58754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729712AbgHQPZQ (ORCPT ); Mon, 17 Aug 2020 11:25:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9FD2623A03; Mon, 17 Aug 2020 15:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677915; bh=T0tVjBCCXbNXEeU92uTxmw1N0dDtQvtH7f6NELAnp1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkuf0c3zmzAJy7TYJ61ZE8olcXaBqiC2dgYBuNPwvoHT1YEDZedvkZC9SBCNv4yf/ uRdFxSUQAF7+NZ9TwvD6RnUhykVrrK3p87Fg41e02K7oKJKhklsXoWRZGVjAbzIfHH yCA69Sz/5tk+4W/KWu+vy22Ry4pXetHvJ18CACWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher , Sasha Levin Subject: [PATCH 5.8 124/464] drm/amd/powerplay: suppress compile error around BUG_ON Date: Mon, 17 Aug 2020 17:11:17 +0200 Message-Id: <20200817143839.751831494@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Evan Quan [ Upstream commit 75bc07e2403caea9ecac69f766dfb7dc33547594 ] To suppress the compile error below for "ARCH=arc". drivers/gpu/drm/amd/amdgpu/../powerplay/arcturus_ppt.c: In function 'arcturus_fill_eeprom_i2c_req': >> arch/arc/include/asm/bug.h:22:2: error: implicit declaration of function 'pr_warn'; did you mean 'pci_warn'? [-Werror=implicit-function-declaration] 22 | pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ | ^~~~~~~ include/asm-generic/bug.h:62:57: note: in expansion of macro 'BUG' 62 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) | ^~~ drivers/gpu/drm/amd/amdgpu/../powerplay/arcturus_ppt.c:2157:2: note: in expansion of macro 'BUG_ON' 2157 | BUG_ON(numbytes > MAX_SW_I2C_COMMANDS); Signed-off-by: Evan Quan Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c index 27c5fc9572b27..e4630a76d7bf5 100644 --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c @@ -2042,8 +2042,6 @@ static void arcturus_fill_eeprom_i2c_req(SwI2cRequest_t *req, bool write, { int i; - BUG_ON(numbytes > MAX_SW_I2C_COMMANDS); - req->I2CcontrollerPort = 0; req->I2CSpeed = 2; req->SlaveAddress = address; @@ -2081,6 +2079,12 @@ static int arcturus_i2c_eeprom_read_data(struct i2c_adapter *control, struct smu_table_context *smu_table = &adev->smu.smu_table; struct smu_table *table = &smu_table->driver_table; + if (numbytes > MAX_SW_I2C_COMMANDS) { + dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", + numbytes, MAX_SW_I2C_COMMANDS); + return -EINVAL; + } + memset(&req, 0, sizeof(req)); arcturus_fill_eeprom_i2c_req(&req, false, address, numbytes, data); @@ -2117,6 +2121,12 @@ static int arcturus_i2c_eeprom_write_data(struct i2c_adapter *control, SwI2cRequest_t req; struct amdgpu_device *adev = to_amdgpu_device(control); + if (numbytes > MAX_SW_I2C_COMMANDS) { + dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", + numbytes, MAX_SW_I2C_COMMANDS); + return -EINVAL; + } + memset(&req, 0, sizeof(req)); arcturus_fill_eeprom_i2c_req(&req, true, address, numbytes, data); -- 2.25.1