Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38130530rwd; Wed, 12 Jul 2023 03:36:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlGhgeNp8LNNALrIRDTnTyYXjpAZkCeUI9I0gnvfiM28/6r37HD2VZuUlsz8oZ8sKgzvMn15 X-Received: by 2002:a92:50d:0:b0:346:2bd:eeec with SMTP id q13-20020a92050d000000b0034602bdeeecmr16266052ile.18.1689158196383; Wed, 12 Jul 2023 03:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689158196; cv=none; d=google.com; s=arc-20160816; b=i7ze1WN+VkfWbO0ZYv/35Nua7xx7853pimr62EZr9QapnkkczUIO7bwYp/ii4iIKt+ qSIrDu6Z7xF6MjK3xb5K2JF0AcVy8ointgZKdxK4eElM/JuuOdYQ46yWbS2xp7VXd+yI v/aSVA+Sl6fMp7l7g9EIu7VDEhcz7Z7eEm2A+HpBotaoyuYSvWKiwohl/Ao0qbBVYssw ySsClPGOU3nLvjsEFRE85pTMdizEzv/kYJYulEWMk9JJXm/xcKvL+bdIK6LOo3dXo4h3 jiIz1gpIs8GUGujSg6IpdlhQUTZfyvfrPFygYsm9h9XQZXNglgAWuuCh6MvS+WFroAx1 NPjQ== 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:cc:to :content-language:subject:user-agent:mime-version:date:message-id; bh=8rehWlI/PEZsgUGnGU52zFqOPBQgg/0JAj9Y8eHv45Q=; fh=gnS2ZzH1sRrDBy6rL/5hyT3RrttuNC/4jkr7tVALAPY=; b=qhIzdowLQf0wXgh7LKbgj6cwQ0GKQZVqUo9pecJa2AhLvIaeebwIJ4YCFKAMpfr+yT KWaT/ZoHLTSBkihi3I8/ck3B4VpcVVFN2jlQ9Do3a/TidDZFEQxhqhnpPoiA98eJ1fDV 4xsM1EOgRsDIGIW0PnuUNkvLL9Z9pzqv2sPilM7QUGtXQYrTSOY9H3134kpTDixb/7kd 2Hu5wPfTRVQGLz+3psSg9rUnuYcx7kBjFKOs2Vl3vU1JNKIqpSQNmDf9VNDkuziOX9OL G64kz7cBp9DhwI1nHhP6rcIEzL+b3Qw92UGNSEWt5g0/7vl0Dl1b8lcQCsSuSoErcTWf +MTA== 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 d6-20020a17090ae28600b00263e4c342fcsi3128763pjz.60.2023.07.12.03.36.24; Wed, 12 Jul 2023 03:36:36 -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 S232270AbjGLKPW (ORCPT + 99 others); Wed, 12 Jul 2023 06:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232890AbjGLKPS (ORCPT ); Wed, 12 Jul 2023 06:15:18 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 2174E19A6; Wed, 12 Jul 2023 03:15:14 -0700 (PDT) Received: from [172.30.11.106] (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id BE9606076583E; Wed, 12 Jul 2023 18:15:09 +0800 (CST) Message-ID: <5194f82f-12d6-05aa-33b7-69c88923e455@nfschina.com> Date: Wed, 12 Jul 2023 18:15:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] drm/virtio: remove some redundant code Content-Language: en-US To: Dan Carpenter Cc: airlied@redhat.com, kraxel@redhat.com, gurchetansingh@chromium.org, olvaffe@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 On 2023/7/12 14:36, Dan Carpenter wrote: > On Wed, Jul 12, 2023 at 09:18:42AM +0800, Su Hui wrote: >> On 2023/7/11 19:13, Dan Carpenter wrote: >>> On Tue, Jul 11, 2023 at 05:00:31PM +0800, Su Hui wrote: >>>> virtio_gpu_get_vbuf always be successful, >>>> so remove the error judgment. >>>> >>> No, just ignore the static checker false positive in this case. The >>> intent of the code is clear that if it did have an error it should >>> return an error pointer. >> Hi, Dan, >> >> Function "virtio_gpu_get_vbuf" call "kmem_cache_zalloc (vgdev->vbufs, >> GFP_KERNEL | __GFP_NOFAIL)" to >> allocate memory. Adding the " __GFP_NOFAIL”flag make sure it won't fail. And >> "virtio_gpu_get_vbuf" never >> return an error code, so I think this is not a false positive. > We all see this and agree. > > However the check for if (IS_ERR()) is written deliberately because we > might change the code to return error pointers in the future. Static > checkers are looking for code that does something unintentional but in > this case the code was written that way deliberately. Got it ,  I shouldn't remove it because the check may be useful in the future. Thanks for your explanation. Su Hui > > regards, > dan carpenter >