Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp627278rdh; Sun, 24 Sep 2023 05:17:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIO+u4j2gI4T3hlITe3028n+XBM51NTkrIw6oe016CLm62BKRTJEXoG3DKEnBD8+5C+TnA X-Received: by 2002:a17:903:110e:b0:1c3:bbad:9b7c with SMTP id n14-20020a170903110e00b001c3bbad9b7cmr2974193plh.31.1695557852094; Sun, 24 Sep 2023 05:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695557852; cv=none; d=google.com; s=arc-20160816; b=dsWOxoL+hlbchv16Zsf5CpTpN+Gk3e9CMgE3OGEOtvVvR54Y2KX0s1i3SJeuwa2vAk axhiyaQ6ROr5Ld+9xmyDRdHxsvELLbH0gPzqSuNCvp4/ta54aFflOCbL0khbO1j1aZRO 9rnHEUmKbu8XoRzSbMidNoWyFRMAHfnViLFFaQMaHWMt2f333UtcGxmM/gm9S6YNBuLH 6Z7zKoBmecpGBgemkd8Dm4Rx8irb6wzGEFj6Ths4gj71U4LlvgaUtzlhPtZluDsi+mvV RaHKRt+5NqzfQTSPOp9CG/sztZJpRexhw6pYlAxWT61BrTkkFAo5ij/WKp9SfShBs7ce 6n1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wW0fsRw7EYcij+1N7xjVLAT1acKLYpEaD/gSjMzJs4s=; fh=s0ktIiem2/lwqIFhfwZXTe7x5mj5iAxY5rJA1kk9+y4=; b=elkEYIQQg+Z4UtH9VKXWTmvx7LnIMRdMH2j8++rYnJxsz/Rpr/LSQP3EknaXeEU9tl rfr7pQUU9gnPqFv/0THDbUjA36PXqPagy22fUEq1sTdcRcGCZCmA3uhuOIpcTVniLHgN K8b4135s2z3mqGzvay/BIBgeW2nkRu2+205Q3l55iigvl7qr+C+/dOZmWcofoD4ZcMrh /kGohSt/nIML5P2CzmcTXSUVCitMGUoR1XIwIdNgAIJ165Wy5Opg50uAJH4djs3zBABq kml+igXb0lixwElG3MghlzJT9WV28pOdg86+91x1Rk5AtcmoQJrY+F3Eh7VlF2A8Eumr 3h3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@treblig.org header.s=bytemarkmx header.b=AFljQZnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id kr13-20020a170903080d00b001bb9533b968si7434510plb.408.2023.09.24.05.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 05:17:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=fail header.i=@treblig.org header.s=bytemarkmx header.b=AFljQZnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6148E8068E1E; Sun, 24 Sep 2023 05:16:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbjIXMQV (ORCPT + 99 others); Sun, 24 Sep 2023 08:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjIXMQU (ORCPT ); Sun, 24 Sep 2023 08:16:20 -0400 Received: from mx.treblig.org (mx.treblig.org [IPv6:2a00:1098:5b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A90FE for ; Sun, 24 Sep 2023 05:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID :Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=wW0fsRw7EYcij+1N7xjVLAT1acKLYpEaD/gSjMzJs4s=; b=AFljQZncfHJN+Ozfw2IKiKh8oO D9DjDMw3E7BwV4V+fbJamtcIYqjIXArxS0L33XtN8MCaQ1k+KHGsvUIilf86r6nTlbMXr+H/cQ6Uo rgL1Iif3Y9qpiXIY1h3RwsY6TLzlwJTuHyjTjo5H9LGE4XCGmaKLvYXKDAKpq+zZBRqY9bBySQMmC 1+3RF4Vnt2xdTEZ6irDJ1MI5igrh1qdYOw9kABVY6gltaktLZxuvwZ9yJKh63PI7PtOQJzXasDcq9 H+NNMjnigtXAoBYSpWmVYK9/HIC8YeBv3xfB5KSy2blqnVKPCdpmn2ojGAhyuE9gFTJyN2RrxppBO bvXoimvw==; Received: from dg by mx.treblig.org with local (Exim 4.96) (envelope-from ) id 1qkO1w-001A0c-0e; Sun, 24 Sep 2023 12:16:08 +0000 Date: Sun, 24 Sep 2023 12:16:08 +0000 From: "Dr. David Alan Gilbert" To: Krzysztof Kozlowski Cc: matthew.brost@intel.com, mgreer@animalcreek.com, linux-kernel@vger.kernel.org, airlied@gmail.com, intel-gfx@lists.freedesktop.org Subject: Re: ERR_PTR(0) in a couple of places Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Chocolate: 70 percent or better cocoa solids preferably X-Operating-System: Linux/6.1.0-12-amd64 (x86_64) X-Uptime: 12:06:53 up 8 days, 15:05, 2 users, load average: 0.03, 0.03, 0.00 User-Agent: Mutt/2.2.9 (2022-11-12) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 24 Sep 2023 05:16:21 -0700 (PDT) * Krzysztof Kozlowski (krzysztof.kozlowski@linaro.org) wrote: > On 24/09/2023 02:41, Dr. David Alan Gilbert wrote: > > Hi, > > I randomly noticed there are a couple of places in the kernel that > > do > > ERR_PTR(0); > > > > and thought that was odd - shouldn't those just be NULL's ? > > > > 1) i915 > > drivers/gpu/drm/i915/gt/uc/selftest_guc_multi_lrc.c : 47 > > > > if (i <= 1) > > return ERR_PTR(0); > > > > from f9d72092cb490 > > > > 2) trf7970a > > drivers/nfc/trf7970a.c : 896 > > > > trf->ignore_timeout = > > !cancel_delayed_work(&trf->timeout_work); > > trf->rx_skb = ERR_PTR(0); > > I would guess that code is relying on rx_skb being valid pointer or ERR > (if (!IS_ERR(...))). If seems mixed, that function calls trf7970a_send_upstream which has both: if (trf->rx_skb && !IS_ERR(trf->rx_skb) && !trf->aborting) print_hex_dump_debug("trf7970a rx data: ", DUMP_PREFIX_NONE, 16, 1, trf->rx_skb->data, trf->rx_skb->len, false); and if (!IS_ERR(trf->rx_skb)) { kfree_skb(trf->rx_skb); trf->rx_skb = ERR_PTR(-ECANCELED); } It's not clear to me whether it's expecteing that 2nd if to happen or not. I notice err.h gained a IS_ERR_OR_NULL to help that case as well. Dave > Best regards, > Krzysztof > -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/