From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 9FBE5227B95 for ; Fri, 26 Dec 2025 19:13:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766776387; cv=none; b=U0/yk5/m2gj9GoF9HmLzb5rKMK7O7ejJYV0MUZAQbri9o2yL2wsFKbIjfMso3j8u6LCxySremfUJUtVcGL4HAaxx554sS7s81jQ6/XHGvE1k6Ep0cpAlB0DpqH5z8dPEQOa4IIRjdt5YgAQi32AFmRRLGeIu+BXxQ4nDG3Gx8LM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766776387; c=relaxed/simple; bh=17M6HtqTq7j2t+UfAwdj+YZAr0dXmoTYEaZUvYzuKh0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hk64HlMsjmHl0Hls1bgx38e5Ma8tkrZRVvU32ZutiF0730BUJxcuJlPpvPtQUTaG05Ia6ajly2LABbgeWIvCXzquTYq3WVVG/s6Aa+AzWygwKxjO6N4pjuQSdEz0Bp4nJllswAQShZ81GHf+xPHIOUXcPLBSkM7zzXGc53OnbJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=E8V/YqE+; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="E8V/YqE+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; 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=T734Hm2KRsYIbSCd0ziky9IH1yt529flsy9t1J4N2kA=; b=E8V/YqE+Tc/S2cg1EQaM+pl2wx 3aF0u+REphL2D3lqtJR2q2VLHwUAwSFKV0UQ2wjTgcH8lMsjBMxlnsSuS5kEDFTJcsDHiYxIgtBbB QR7x+zdmYzjl9HgXRrwHuvc4veYeeFOQinGFNHfg2Xq44CvfUFjJf85ji7WZdWxRKNzBBYuFAfpWK 5ZpytygIVDQLvIZmXzv19BrBq0Qk2e3C7nCEZs79+PNfd0tpiJ6/ljufc58XXWHqz21A+/IibHbGY 2QBA4alMQlSQUlFs/BWqedC1GQOrO8grjXn1q4HRxNEp/AQZy/Vc6larnJppLlcBYL0hlyt0hAkGp i0k4WcCA==; Received: from 179-125-71-241-dinamico.pombonet.net.br ([179.125.71.241] helo=quatroqueijos.cascardo.eti.br) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vZDF5-00GmT0-HI; Fri, 26 Dec 2025 20:12:52 +0100 Date: Fri, 26 Dec 2025 16:12:46 -0300 From: Thadeu Lima de Souza Cascardo To: Alper Ak Cc: arnd@arndb.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] char: misc: Use IS_ERR() for filp_open() return value Message-ID: References: <20251226091451.33900-1-alperyasinak1@gmail.com> 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-Disposition: inline In-Reply-To: <20251226091451.33900-1-alperyasinak1@gmail.com> On Fri, Dec 26, 2025 at 12:14:51PM +0300, Alper Ak wrote: > filp_open() never returns NULL, it returns either a valid pointer or an > error pointer. Using IS_ERR_OR_NULL() is unnecessary. Additionally, if > filp were NULL, PTR_ERR(NULL) would return 0, leading to a misleading > error message. > > Fixes: 74d8361be344 ("char: misc: add test cases") > Signed-off-by: Alper Ak > --- > drivers/char/misc_minor_kunit.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/misc_minor_kunit.c b/drivers/char/misc_minor_kunit.c > index 6fc8b05169c5..e930c78e1ef9 100644 > --- a/drivers/char/misc_minor_kunit.c > +++ b/drivers/char/misc_minor_kunit.c > @@ -166,7 +166,7 @@ static void __init miscdev_test_can_open(struct kunit *test, struct miscdevice * > KUNIT_FAIL(test, "failed to create node\n"); > > filp = filp_open(devname, O_RDONLY, 0); > - if (IS_ERR_OR_NULL(filp)) > + if (IS_ERR(filp)) > KUNIT_FAIL(test, "failed to open misc device: %ld\n", PTR_ERR(filp)); > else > fput(filp); > -- > 2.43.0 > Acked-by: Thadeu Lima de Souza Cascardo Also, if possible, please add the following, as this was previously reported, and I forgot to fix it: Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202506132058.thWZHlrb-lkp@intel.com/ Thanks. Cascardo.