Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2155467lqz; Tue, 2 Apr 2024 08:43:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8KGVkv/HK1/QmL1QZnO1IpS64KYIaE2AWQpk27pU/1yHaVh1HoYKUXXGZk+l10NoV5F10rhL5YzfWhVvqjnHvrzU/ZIzJeSzby2oY4Q== X-Google-Smtp-Source: AGHT+IE5W4al3NMpJlzddaMRtRWi71wki5HGEhWgQCu5xbpKbKSc0pfgiaUklr7tCqbxGIgwYpr0 X-Received: by 2002:a17:90a:6390:b0:29b:c2b3:2712 with SMTP id f16-20020a17090a639000b0029bc2b32712mr11248161pjj.26.1712072620331; Tue, 02 Apr 2024 08:43:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712072620; cv=pass; d=google.com; s=arc-20160816; b=NTN4vkBPKse4/jKf506dD82dQTuT0+tJTseXOBwfpNPwI+yUGKgjCAscXS98Jr9MEQ lEGYiS131Rd9XetIK8tpB+h3k0FCsp5719NUw3D9OR/khnAyaVcTmCdcltNVUN1pxasy doPvVbWkkRsntmbKqjEB8+llGs5BIqXYVVH8XREZ1mweLwYsmqYcvwyti3kdPmOPweBX +K5cjZ431aQVRrM8dla3AriOzt5ouEwGj0ftt0pSoeoe0DF7beB1CrNDoTqKjJ3z70kl /8+9AVRgI5JLV5CntM6eLWPV/LDYVglKIsRMPfNlvEdR0aRZOCDvap9inb25N/iO5xbM Xalw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=AhdKhkTiFHm1ocsJtafw0L4hHyZeByr65TdVVsQIeMY=; fh=Zf29XQnG5LmI3rPe48rcSR2tOZFltXm0r++EAUmvwi4=; b=VKayb4pS85pxl6RRH7ONNdEfX5M3DVjeCJGtltpmFEmnbhIFA3pbCFcyVXZR/XQ99D HB7JY7zRCi6691D7/PABlYsoTAhEw+xkpIOAuAquuSVfYrNP7Rq+sJQtxf1AbvrFiB8C N05fXfAnc8bHkiygnhMkWdb9TEJGOiBl+dhv0BKeNDevsi+F88qYvFXKHOQGrRl5WKNH Q2gwRNZ4j49Y7HMrLZy44KaG7zTJPLmr/9EKJK7Kn9DKI+/9HfLDV5cDAVN2+mjwFGaK ZdiECpEP9HVWlOBQrGPEmMB3r+a3XLh/nTpRu2kmIsqnBn8QkjOr87Z26rBt4sTiD8Pa usvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GY2ORIGd; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-128233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z16-20020a17090abd9000b002a2580db3c0si1524629pjr.184.2024.04.02.08.43.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 08:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GY2ORIGd; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-128233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EC8F4B2562F for ; Tue, 2 Apr 2024 15:19:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D8CC12F39B; Tue, 2 Apr 2024 15:19:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="GY2ORIGd" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0292D12D771; Tue, 2 Apr 2024 15:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712071171; cv=none; b=KlgdZoLA+6IOEkgsyvHj+5vIFdR08N0e9IvSdHeEmNCat/8d31k3coDLdWNU7/0kY7nYEjQkYcLcuDRB5drFKZ59Gf7ln3bBKKfDjCWiAqV/oiUd/tet4hVdaKPdZyudXtBYKSCxam09tuZZGdDaEqaRF79YjoyPt+BhlSKhgao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712071171; c=relaxed/simple; bh=U8hrt2COlh1X8zQqKdj1binoX1xhmTI1QSOBv6cNndE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MKWLIJJe8DOSFTr7sKfP8b/GAK5fOcHMEeWhjM6BepZOoRH1eHkMkoLkqIl4Z8CSkkueDqvach0sRvvtWqI3GoNKe+YIU6+QgTudanjAmMaHKyUHB6ysP2A3vNrpC3d58asNLXl4G6fy15SRhbdtfr8rNKeXZ+4D0GlFbVKeVSM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=GY2ORIGd; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1712071168; bh=U8hrt2COlh1X8zQqKdj1binoX1xhmTI1QSOBv6cNndE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GY2ORIGdVU4Pt/orK+mi4O2Mfxy3wpYDxy/EEaWhVXds6QiAZrs2I2ugll5b7oLyo H2OIjW5w79UBgemHrXdAO+hta1mnE8dbdr2jWoFvFX7zqApDwH6pTR+jbsYfBPXnWD agjcLcfziOANptDPpg6072nuiNxUVEJENPevs4cQsSrHo+T+AGa1a8J8RdHu/euks0 V079EPkQSAhK1zys/vTsHOxGFxU+mKb17bmMF+HDB0PL2nxi8BIhzMF29CJFTIlb6/ drx80NBJvL7kQ5Lap2lraTpowTFCPD9pYgVTMKIAvLtI9IhpNpEhB2FnXzwYCMEXun f23CUA9JyicZA== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 439C5378143B; Tue, 2 Apr 2024 15:19:27 +0000 (UTC) Date: Tue, 2 Apr 2024 17:19:25 +0200 From: Boris Brezillon To: Dan Carpenter Cc: Harshit Mogalapalli , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Heiko Stuebner , Grant Likely , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, error27@gmail.com Subject: Re: [PATCH v3] drm/panthor: Fix couple of NULL vs IS_ERR() bugs Message-ID: <20240402171925.41dce3a5@collabora.com> In-Reply-To: <91e25b42-c3fa-4b69-ab8c-5d79610e757b@moroto.mountain> References: <20240402141412.1707949-1-harshit.m.mogalapalli@oracle.com> <20240402163838.34003a10@collabora.com> <91e25b42-c3fa-4b69-ab8c-5d79610e757b@moroto.mountain> Organization: Collabora X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 2 Apr 2024 17:44:18 +0300 Dan Carpenter wrote: > On Tue, Apr 02, 2024 at 04:38:38PM +0200, Boris Brezillon wrote: > > On Tue, 2 Apr 2024 07:14:11 -0700 > > Harshit Mogalapalli wrote: > > > > > Currently panthor_vm_get_heap_pool() returns both ERR_PTR() and > > > NULL(when create is false and if there is no poool attached to the > > > > ^ pool > > > > > VM) > > > - Change the function to return error pointers, when pool is > > > NULL return -ENOENT > > > - Also handle the callers to check for IS_ERR() on failure. > > > > > > Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block") > > > > I would explain that the code was correct, but the documentation didn't > > match the function behavior, otherwise it feels a bit weird to have a > > Fixes tag here. > > The code wasn't correct, it returned a mix of error pointers and NULL. AFAICT, this is allowed, otherwise why would we have IS_ERR_OR_NULL(). The fact smatch can't see through panthor_vm_get_heap_pool() and detect that the return value is different for create=false/true doesn't mean the code was wrong. I'm certainly not saying this is a good thing to have a function that encodes the error case with two different kind of return value, but I wouldn't qualify it as a bug either. What's incorrect though, is the fact the documentation doesn't match the code. > So it needs a Fixes tag. I didn't say we should drop the Fixes tag, but the bug being fixed here is a mismatch between the doc and the implementation, the code itself was correct, and the behavior is actually unchanged with this patch applied, it's just done in a less confusing way. Regards, Boris