Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1014913ybj; Thu, 7 May 2020 12:44:28 -0700 (PDT) X-Google-Smtp-Source: APiQypK0FiLrVq9fUv9mbieKaA5vhvj3FPLbT5ZyDhWuTX6dJJM9Gq1ZszF2oXQWMyFTAtCncT34 X-Received: by 2002:aa7:d689:: with SMTP id d9mr13684991edr.22.1588880667972; Thu, 07 May 2020 12:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588880667; cv=none; d=google.com; s=arc-20160816; b=tUHjSoANiZHU3YKg33dNqibzTIIRYXkITmOgSfiBu0WelBJ2lSwfOCUODsr5Q0Kg4h lypSoUhbnAWnSx0AYZzrrwJvIrkcz7ljN4r/CglJ3uPZcIJpTAuu8+hp9YWo1rMLfqTU T/vvJjN3b4vPlXOHPkPyUJziNhzw6QUED8p7KrmKIAcCBZWhDGEMTqYPJFnf2J0ErK7C WSRLRT9OVO/9k9MJo1GJ4t8ysYNHnHY8BRSpGazzegfW6GPx01XDeBs4g78HhEDChKGP qI2mkqL4hbjHLuGUHJ1YmPcw+Mr7s08bS7/yeVnRPAiIihuD0XqMMCBx59+uRq88KLdQ 1TZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PMpVNBoEhxmM4CRkfdIX0zaCW76FCXVtwoTgqUPcVLU=; b=hY7d7Xa5DvDnua2AyMFOdUrGU+4yoSp0Eikg+VwD71txn8GvEN5KP4VSbYO5PcB8yR 7/NuivWEdljGemTVDx3A8ouRvMA+kjCk0kD6u1nsBFEjeoUktX/onSojND2QIYclY3q1 c9SKqNOQBZypAyj5vweph/6R42Mo71Tmt4irHaSRzZebc8z9Hl2IBz7uOJ+E4kNp+/Ap baIjrUCdS6Vd1274bJEmb3eoX5jOGMWKBWiPyUwQfFPMsEtg+e0TKCMpP7E3ZbGNY9dN VO091usaHM99os982Epi5IRl3vhhB6eCdEAWqDO+VN2QQ/i711H79/HNhKWwqh0OUgdi W/SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HX97W0ux; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si3755860ejf.272.2020.05.07.12.44.03; Thu, 07 May 2020 12:44:27 -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=@gmail.com header.s=20161025 header.b=HX97W0ux; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbgEGTlp (ORCPT + 99 others); Thu, 7 May 2020 15:41:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726320AbgEGTlo (ORCPT ); Thu, 7 May 2020 15:41:44 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BF6CC05BD43 for ; Thu, 7 May 2020 12:41:44 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id x4so7844906wmj.1 for ; Thu, 07 May 2020 12:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PMpVNBoEhxmM4CRkfdIX0zaCW76FCXVtwoTgqUPcVLU=; b=HX97W0uxJyJtTZ3HW9vIAYer0wvYtLnSikfxmAflXPahf0PgFsIk0LGBDsJfVVrzP6 x3FABNboCvUFz9RilZ7X33rF8JL7u16GUL9zLUiOE/80ITtDvC/hmPUAzRo2QCzMlQEf DuS3fcoY23eYsOCcErlMfOrfIvAoV40J1f90Z0ouwbNBfmSLLKwngBA2cnleXbOz5Ije yc15pVmsIdGTk9avwk9xUFH+UrVqJAJAOvjHxN6BwvWAHyB/4OKuGOOdcP6Eb2pt7w59 u2ctaW0Lk7d92HpR2PcZhsDkbcM1KvAvJ8tE8YytiSt8agVvChqT69F8psGu4vGEGMyT ivHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PMpVNBoEhxmM4CRkfdIX0zaCW76FCXVtwoTgqUPcVLU=; b=PW9rw90nrQLGWOaX6PZKmdN6Wbgz+8hTmX3lvHsVVfdpPD3/4rjlOnG10XVd9JsJPX E+yClnNC+YIrArndgBamniMu81CKsDGVDYO4jAcup9ZIAS9P2yaE8y49Y5dMxQH4fmuc erqDXggnvRa0wFBkDSIaDuTZMr+bPttFV70Qun7Qsp6532/YiieB0Q6VDkNgU34kkgNR BaEsOc2+fBMwZx7loHApkpzP86Spxh4nHJAB2KmdVXnvPyGI5ufRlvN1y20lAerXB1ln +1LJtqIHYxx1/XiX58ok2ytu5zQN3PotXLEp0cJ/Lx68ynoHPNoljP2PMe+m2vUYShUQ V46g== X-Gm-Message-State: AGi0PuY7b90qwxJhhxKLKj+XukaXgl1QeAN1iGN3A922cXnjWqsCBE0j cSu9bqLGgmklIpxGGF9D9+9PJpGYWrFlM8aczs0WrA== X-Received: by 2002:a1c:6344:: with SMTP id x65mr12146860wmb.56.1588880502897; Thu, 07 May 2020 12:41:42 -0700 (PDT) MIME-Version: 1.0 References: <20200507112412.10829-1-chentao107@huawei.com> In-Reply-To: <20200507112412.10829-1-chentao107@huawei.com> From: Alex Deucher Date: Thu, 7 May 2020 15:41:31 -0400 Message-ID: Subject: Re: [PATCH -next] drm/amd/dc: Remove a useless comparison To: ChenTao Cc: Dave Airlie , Daniel Vetter , "Cyr, Aric" , "Leo (Sunpeng) Li" , Anthony Koo , "Siqueira, Rodrigo" , murton.liu@amd.com, amd-gfx list , LKML , Maling list - DRI developers , "Wentland, Harry" , Sam Ravnborg , Christian Koenig , Su Sung Chung Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 7, 2020 at 9:35 AM ChenTao wrote: > > Fix the following warning: > > 'en' is uint32_t and can never be negative. > > drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_hpd.c:132:10: warning: > comparison of unsigned expression < 0 is always false [-Wtype-limits] > if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) { > drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_generic.c:109:10: warning: > comparison of unsigned expression < 0 is always false [-Wtype-limits] > if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) { > While it's not required, I think it improves readability and protects if the enum has negative values. I think it would be better to change the en var to signed. Alex > Reported-by: Hulk Robot > Signed-off-by: ChenTao > --- > drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c | 2 +- > drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c > index f9e847e6555d..6cd50232c432 100644 > --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c > +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c > @@ -106,7 +106,7 @@ void dal_hw_generic_init( > enum gpio_id id, > uint32_t en) > { > - if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) { > + if (en > GPIO_DDC_LINE_MAX) { > ASSERT_CRITICAL(false); > *hw_generic = NULL; > } > diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c > index 692f29de7797..f91f426699c0 100644 > --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c > +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c > @@ -129,7 +129,7 @@ void dal_hw_hpd_init( > enum gpio_id id, > uint32_t en) > { > - if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) { > + if (en > GPIO_DDC_LINE_MAX) { > ASSERT_CRITICAL(false); > *hw_hpd = NULL; > } > -- > 2.22.0 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx