Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1467459rdh; Mon, 25 Sep 2023 13:50:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXYOyaX0KpkryVbeX+61+8dH4Tj94Jx61OQywieLKAqWs9X75eptG2PjIEBv/d99yve+4W X-Received: by 2002:a17:903:2348:b0:1c4:13cd:b85f with SMTP id c8-20020a170903234800b001c413cdb85fmr5412106plh.5.1695674980038; Mon, 25 Sep 2023 13:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695674980; cv=none; d=google.com; s=arc-20160816; b=m+Pfu+lnWgpGlzeuoDTXtG6qpRx/J2Xu/KSZaCtjG0bX5V2AySyU3axku2lrq+jUzw fQEwFFLn8GcXKh0s9luBcKHXKSlaVysU/FwRhfUaugqWUDBIzG0Im1pGv8QVRWDVIOVU cM4RbK0yZfiBbKG1hL9cEjz7tTNgTqjDGIPUg9P2IlqXJO8x9XMR2l+tkaNFm1DlD8zY XVle+EB8aAD66zH8yA1TXk8E6PML436/OaH+Tu3P5WutbBKWqerbHBujanaUG7j22RrY xRjnnHwIz6sX0hkw+g/rJN6u+JqN0d9gMbzKKd0jJoRQ4VKq9r7HmNm0UA/xpQlMmhan jR7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=o3mqjDNGx2SUlNIkt99b1HPgu6LuEopbnmFGVN0Aehg=; fh=t48iev2lhIiBMU77RtDP6xX3BR/GsJOMCTQeHCNxdrc=; b=IJG3VKY6rQpE6Y7G1MXRuzMfsSj3G1PqtC6IaGG4zP80jO3dpBhUEScKUPQQ9gQzA5 q1TCNjBh5mbK8mYoNi6WHjwJ/oCCltNd7skz6ql7V1RDnlq+MPkX6pkmnsp4a2ykgMji 3WNmRpeN2GBh7Dj/6+xEgw5Hm4whYvEIoPJjlvKoJNg49B8miumcj0yRNLTq15So0Xw4 5UaYOf5qzw3WlgGlxGYhi+M075jRvdFaYEoD8NCdV0hQ+lI/9SPOrEyLWFmBgT7zbfLu IbtTOJpXcJrmIRS04f3+5Wxv2TMc/keFe7ndiylaBjPsXq5qljYEimIb/u3gVJCRvyxR 9rSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S8aevG02; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id j5-20020a170902c3c500b001c6036c5b74si5604054plj.245.2023.09.25.13.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 13:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S8aevG02; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 34A6B81BFA93; Mon, 25 Sep 2023 08:09:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232605AbjIYPJU (ORCPT + 99 others); Mon, 25 Sep 2023 11:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232364AbjIYPJT (ORCPT ); Mon, 25 Sep 2023 11:09:19 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 197F1FF for ; Mon, 25 Sep 2023 08:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695654553; x=1727190553; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=tQLVrYpCL0nfs9//RXQMdDZzJjLejMo0pgtvzV3pWm8=; b=S8aevG02maOvWbb95opbYS8hhj2wxEwqGsFfbS6IXT6ajcZ1s7McWkNJ p+rEuA3B/oSWzVwbsNGVKDtLHhiBaGOBZfzxzF7AcRws/73uijFJI8gU5 QOmJRng/DRh/v7GW0v8Jz03ippZVp4jvUmUYYX8mocMg5PO9d8WEqHvRG ZeGPTRydROwqOlieFZRbQUQPmbSfrV6JwWPPEevdE6MsYYtlbfsEVODfq 59oZdnJcPmhBB3rdAZI6zstPm1gYT7GIb3Oqf5pimHHM+cEsUKMZ1sFQ/ mumoOGKM/oOTasJYV5yQ+QrU3iRCpuOPOH1LATe00l58cjeuVh99VEj4j Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="385110537" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="385110537" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:09:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="751735492" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="751735492" Received: from smgotth-mobl.ger.corp.intel.com (HELO localhost) ([10.252.40.46]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:09:10 -0700 From: Jani Nikula To: Randy Dunlap , Matthew Brost , "Dr. David Alan Gilbert" Cc: krzysztof.kozlowski@linaro.org, airlied@gmail.com, mgreer@animalcreek.com, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [Intel-gfx] ERR_PTR(0) in a couple of places In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: Date: Mon, 25 Sep 2023 18:09:07 +0300 Message-ID: <87cyy6mgrw.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:09:19 -0700 (PDT) On Sun, 24 Sep 2023, Randy Dunlap wrote: > On 9/24/23 21:18, Matthew Brost wrote: >> On Sun, Sep 24, 2023 at 12:41:07AM +0000, 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); >> >> Yes, s/ERR_PTR(0)/ERR_PTR(NULL)/ >> >> Matt > > I agree with Dave's original suggestion since casting NULL isn't needed. Yeah, s/ERR_PTR(0)/NULL/ would be my choice as well. As a side note, I generally think it's better not to mix NULL and error pointers in error return values for a function, because they're harder to handle properly. BR, Jani. > >> >>> >>> from f9d72092cb490 >>> >>> 2) trf7970a >>> drivers/nfc/trf7970a.c : 896 >>> >>> trf->ignore_timeout = >>> !cancel_delayed_work(&trf->timeout_work); >>> trf->rx_skb = ERR_PTR(0); >>> trf7970a_send_upstream(trf); >>> >>> from 1961843ceeca0 >>> >>> Dave >>> -- >>> -----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 |_______/ -- Jani Nikula, Intel