Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35247896rwd; Mon, 10 Jul 2023 04:59:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlF8BQwraKtxcfy3dLS3h5b079rhzuM8t3+tMU303CXFQ013Hzd39kaBByCo6++k9bKjXuNk X-Received: by 2002:a05:6512:2103:b0:4f8:66a1:a31b with SMTP id q3-20020a056512210300b004f866a1a31bmr8856756lfr.30.1688990380254; Mon, 10 Jul 2023 04:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688990380; cv=none; d=google.com; s=arc-20160816; b=Kw+Q9eTMseuCD+R2CeqSbMMqB53PU6JA87ucVGWGGolzcHAjw9xi03oPPBaZ6/aeCD /kGY/kAZIDng6PU2t+iy3lAUsFbAteKqShsjO3cQRSJB4jSh4MARamaC84U6l0HYD3KZ LAT3SOUAEqU0Z2rJlJyu0pvAiJy67eRa5GXqkK/Mjk4ZxAeRwwuqK3JYITfD81POzq6J SZRyK16N0rYeMmak7ZBybkGfN9JG6HvDwovutg+8Ai6D/jOKNO74+W3jeRH9VtKYc0lX aMHUfQrr+kqTd/Q9bua0EkBZhx4K9psV1gzklhm2gEGn1niELmtHgCfJlBwyA7J2XTQ3 /EDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=Mdy+Gub2E+9a5z7UMNckX8tHzOjcqu9ePXt1eFnqcsE=; fh=8yu1D8SzVeJt0xQJ4tbmv4bEa9DtEzwUwoDXwiPxm+4=; b=i85P0Et27uxOX5EbutykVDIMu/M+A/P79lrlRgLqpkbVx7ClyQ5BN1U8ffLt0bTknn vHNoZbY2O84T22fp7xjyFSkXReyH2rcH4f26VRQlwuN2RVQjCQTuDtWqm8ZdZWVkUdWz K5mlTVF8yguetfI7hzJY0Yb/zltLWyTPdUkkSKJRVXvg2BRSGmvql+zoCyrNhNNgFwKq 7LbUJ3EF0y5drGDpPAUctWVbuOceN7LZ5ZtuU25Bvmky+djpyLZjlBkEPtRZgLdS1gbu ylMjCxXRtdmq6ejlDPPNik5cOoRITUEj0nQH3nrYXOP1Xm8p54GPeDFiBzPVmLlu8DkF utvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd10-20020a170906ce2a00b009873cbdd6cfsi9199575ejb.706.2023.07.10.04.59.16; Mon, 10 Jul 2023 04:59:40 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbjGJLew (ORCPT + 99 others); Mon, 10 Jul 2023 07:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjGJLev (ORCPT ); Mon, 10 Jul 2023 07:34:51 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5CABFE1 for ; Mon, 10 Jul 2023 04:34:48 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8CxNvHW7KtkCB8DAA--.9167S3; Mon, 10 Jul 2023 19:34:46 +0800 (CST) Received: from [10.20.42.43] (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxviPE7Ktk5DwnAA--.5489S3; Mon, 10 Jul 2023 19:34:45 +0800 (CST) Message-ID: <8182fecd-d290-293a-d963-ddbea79dbf03@loongson.cn> Date: Mon, 10 Jul 2023 19:34:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] drm/loongson: Remove a useless check in cursor_plane_atomic_async_check() To: Thomas Zimmermann , David Airlie , Daniel Vetter , Li Yi Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Dan Carpenter References: <20230710102411.257970-1-suijingfeng@loongson.cn> <6c7bbce7-5521-b868-019f-bce26f309730@suse.de> Content-Language: en-US From: suijingfeng In-Reply-To: <6c7bbce7-5521-b868-019f-bce26f309730@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxviPE7Ktk5DwnAA--.5489S3 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoWxCr1DKF47Gw4UWr1kWw17urX_yoWrJF1kpr WkJry8CrWUJr1xJr9rJr1Utry5uw47tw1xWF1UJF1UtFWUtr1Yqr1UXryjgr4UArW8Gr1U Jr1UJFn8ZF1UtrcCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUB2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU XVWUAwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI4 8JMxk0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_ Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E 14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU4oGQDUUUU X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2023/7/10 18:39, Thomas Zimmermann wrote: > > > Am 10.07.23 um 12:24 schrieb Sui Jingfeng: >> Because smatch warnings: >> >> drivers/gpu/drm/loongson/lsdc_plane.c:199 >> lsdc_cursor_plane_atomic_async_check() >> warn: variable dereferenced before check 'state' (see line 180) >> >> vim +/state +199 drivers/gpu/drm/loongson/lsdc_plane.c >> >> 174  static int >>       lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane, >> 175                                       struct drm_atomic_state >> *state) >> 176  { >> 177          struct drm_plane_state *new_state; >> 178          struct drm_crtc_state *crtc_state; >> 179 >> 180          new_state = drm_atomic_get_new_plane_state(state, plane); >>                                                          ^^^^^ >> state is dereferenced inside this function >> >> 181 >> 182  if (!plane->state || !plane->state->fb) { >> 183          drm_dbg(plane->dev, "%s: state is NULL\n", plane->name); >> 184                  return -EINVAL; >> 185  } >> 186 >> 187  if (new_state->crtc_w != new_state->crtc_h) { >> 188          drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n", >> 189                  new_state->crtc_w, new_state->crtc_h); >> 190          return -EINVAL; >> 191  } >> 192 >> 193  if (new_state->crtc_w != 64 && new_state->crtc_w != 32) { >> 194          drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n", >> 195                  new_state->crtc_w, new_state->crtc_h); >> 196          return -EINVAL; >> 197  } >> 198 >> 199  if (state) { >>           ^^^^^ >> Checked too late! >> >> Reported-by: Dan Carpenter >> Closes: https://lore.kernel.org/r/202307100423.rV7D05Uq-lkp@intel.com/ >> Signed-off-by: Sui Jingfeng > > Acked-by: Thomas Zimmermann > > BTW, you're posting these patches for loongson, I'm posting these patches for the drm/loongson driver in drm-misc and/or drm-tip branch, what do you means for *loongson*, > but that driver is not yet in our tree? > I already applied(push) drm/loongson driver to drm-misc-next branch, What do you means that by "not yet in our tree", linux kernel side? Am I missing something ? > Best regards > Thomas > > >> --- >>   drivers/gpu/drm/loongson/lsdc_plane.c | 8 +------- >>   1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/drivers/gpu/drm/loongson/lsdc_plane.c >> b/drivers/gpu/drm/loongson/lsdc_plane.c >> index 2ab3db982aa3..0d5094633222 100644 >> --- a/drivers/gpu/drm/loongson/lsdc_plane.c >> +++ b/drivers/gpu/drm/loongson/lsdc_plane.c >> @@ -196,13 +196,7 @@ static int >> lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane, >>           return -EINVAL; >>       } >>   -    if (state) { >> -        crtc_state = drm_atomic_get_existing_crtc_state(state, >> new_state->crtc); >> -    } else { >> -        crtc_state = plane->crtc->state; >> -        drm_dbg(plane->dev, "%s: atomic state is NULL\n", plane->name); >> -    } >> - >> +    crtc_state = drm_atomic_get_existing_crtc_state(state, >> new_state->crtc); >>       if (!crtc_state->active) >>           return -EINVAL; >