From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0962C64E7A for ; Tue, 1 Dec 2020 14:39:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D84820757 for ; Tue, 1 Dec 2020 14:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391624AbgLAOjd (ORCPT ); Tue, 1 Dec 2020 09:39:33 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40354 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391368AbgLAOjd (ORCPT ); Tue, 1 Dec 2020 09:39:33 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 1E32E1F44B45 Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code To: Dan Carpenter Cc: Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20201201142754.GI2767@kadam> From: Helen Koike Message-ID: Date: Tue, 1 Dec 2020 11:38:33 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201201142754.GI2767@kadam> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, On 12/1/20 11:27 AM, Dan Carpenter wrote: > On Mon, Nov 30, 2020 at 11:20:05AM -0300, Helen Koike wrote: >> Hi Dan, >> >> Thank you for your patch. >> >> On 11/30/20 9:53 AM, Dan Carpenter wrote: >>> The debugfs_create_dir() function never returns NULLs. It's not supposed >>> to checked for errors in the normal case and there is no need to check >>> in this function so let's just delete this dead code. >>> >>> Signed-off-by: Dan Carpenter >>> --- >>> drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 ---- >>> 1 file changed, 4 deletions(-) >>> >>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> index 9af137e4967f..68da1eed753d 100644 >>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) >>> struct rkisp1_debug *debug = &rkisp1->debug; >>> >>> debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); >>> - if (!debug->debugfs_dir) { >>> - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); >>> - return; >>> - } >> >> I was taking a look at the debugfs_create_dir() code, and I saw it can >> return ERR_PTR(), so ideally we should check for errors with IS_ERR() / PTR_ERR(). > > Debugfs functions aren't meant to be error checked in the normal case. > There are some drivers which dereference the dentry pointer so those > need to check it but that's not very common and isn't the case here. right, I just saw the functions in inode.c already checks the parent with IS_ERR(). the debugfs_create_*() function calls start_creating() which already checks the parent. ok, fair enough, I'll ack v2. Regards, Helen > > I'm really sure this must be documented somewhere but I can't find it > at all. :P But look at commit 057e212eae72 ("media: usb: uvc: no need > to check return value of debugfs_create functions") for example. > > regards, > dan carpenter > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Helen Koike Date: Tue, 01 Dec 2020 14:38:33 +0000 Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code Message-Id: List-Id: References: <20201201142754.GI2767@kadam> In-Reply-To: <20201201142754.GI2767@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Dafna Hirschfeld , Heiko Stuebner , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Hi Dan, On 12/1/20 11:27 AM, Dan Carpenter wrote: > On Mon, Nov 30, 2020 at 11:20:05AM -0300, Helen Koike wrote: >> Hi Dan, >> >> Thank you for your patch. >> >> On 11/30/20 9:53 AM, Dan Carpenter wrote: >>> The debugfs_create_dir() function never returns NULLs. It's not supposed >>> to checked for errors in the normal case and there is no need to check >>> in this function so let's just delete this dead code. >>> >>> Signed-off-by: Dan Carpenter >>> --- >>> drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 ---- >>> 1 file changed, 4 deletions(-) >>> >>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> index 9af137e4967f..68da1eed753d 100644 >>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) >>> struct rkisp1_debug *debug = &rkisp1->debug; >>> >>> debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); >>> - if (!debug->debugfs_dir) { >>> - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); >>> - return; >>> - } >> >> I was taking a look at the debugfs_create_dir() code, and I saw it can >> return ERR_PTR(), so ideally we should check for errors with IS_ERR() / PTR_ERR(). > > Debugfs functions aren't meant to be error checked in the normal case. > There are some drivers which dereference the dentry pointer so those > need to check it but that's not very common and isn't the case here. right, I just saw the functions in inode.c already checks the parent with IS_ERR(). the debugfs_create_*() function calls start_creating() which already checks the parent. ok, fair enough, I'll ack v2. Regards, Helen > > I'm really sure this must be documented somewhere but I can't find it > at all. :P But look at commit 057e212eae72 ("media: usb: uvc: no need > to check return value of debugfs_create functions") for example. > > regards, > dan carpenter > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4724CC64E7B for ; Tue, 1 Dec 2020 14:39:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C51620757 for ; Tue, 1 Dec 2020 14:39:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y/o62wIU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C51620757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YdFSO4n2Lxb0F5pN100jqj6U75lstgZCSkdAJZY2f/c=; b=Y/o62wIUIY1xz+fgcxIN5GoTA dAHTdWENrTWy3uD9bF0hGdkbS/EXYd5XGCSsJqBFQADuYKcJBhiA5JuBnHFHTOOByTOjcMzE9x2/d HM1uAGdFuTYHbAPpTi55aLGr1DYTesAi8vu0gj2MrZLpgX49JC8pja7RYJJZUH/mrczm2utvl5n8/ WDIM/03c4LSr56U9Iymk35CKkp1o+B0FGpdB8zVduUa/4re3NwDW/bUATlY1Jb9deGpKUC/MF8/LI ixYXwUGpK89xDlBmp3vRpZsmgjwNm4A2HkEiRABHR3XYJMaB2ip9uHMGpeta84SfvgKnSdVZ3FXBs UsBC//Dlg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6nx-0003IU-Fp; Tue, 01 Dec 2020 14:38:57 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6nt-0003HG-LM; Tue, 01 Dec 2020 14:38:54 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 1E32E1F44B45 Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code To: Dan Carpenter References: <20201201142754.GI2767@kadam> From: Helen Koike Message-ID: Date: Tue, 1 Dec 2020 11:38:33 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201201142754.GI2767@kadam> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_093853_825491_12426A75 X-CRM114-Status: GOOD ( 21.73 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dafna Hirschfeld , Heiko Stuebner , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Hi Dan, On 12/1/20 11:27 AM, Dan Carpenter wrote: > On Mon, Nov 30, 2020 at 11:20:05AM -0300, Helen Koike wrote: >> Hi Dan, >> >> Thank you for your patch. >> >> On 11/30/20 9:53 AM, Dan Carpenter wrote: >>> The debugfs_create_dir() function never returns NULLs. It's not supposed >>> to checked for errors in the normal case and there is no need to check >>> in this function so let's just delete this dead code. >>> >>> Signed-off-by: Dan Carpenter >>> --- >>> drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 ---- >>> 1 file changed, 4 deletions(-) >>> >>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> index 9af137e4967f..68da1eed753d 100644 >>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) >>> struct rkisp1_debug *debug = &rkisp1->debug; >>> >>> debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); >>> - if (!debug->debugfs_dir) { >>> - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); >>> - return; >>> - } >> >> I was taking a look at the debugfs_create_dir() code, and I saw it can >> return ERR_PTR(), so ideally we should check for errors with IS_ERR() / PTR_ERR(). > > Debugfs functions aren't meant to be error checked in the normal case. > There are some drivers which dereference the dentry pointer so those > need to check it but that's not very common and isn't the case here. right, I just saw the functions in inode.c already checks the parent with IS_ERR(). the debugfs_create_*() function calls start_creating() which already checks the parent. ok, fair enough, I'll ack v2. Regards, Helen > > I'm really sure this must be documented somewhere but I can't find it > at all. :P But look at commit 057e212eae72 ("media: usb: uvc: no need > to check return value of debugfs_create functions") for example. > > regards, > dan carpenter > _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06208C64E7B for ; Tue, 1 Dec 2020 14:40:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 813F320757 for ; Tue, 1 Dec 2020 14:40:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0B8g/5tY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 813F320757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nfXUzEwUZRTJkQpPGb0qHQcmasH8iqmX7XqB//KlEX0=; b=0B8g/5tYCPvpVGErgXd6DUPSH rCQftvH9UmAmuB2xrsfgS5LC85yextOBbzCKinZVQ5ipCLv4j6/Gmw3m8/MDbj0Q7/AiwTfdC8VL1 dl+Rwb1tFNmT46a4fMXsybz2x0j5us/iSOiu3m9dV5kNAmMgZLazILNji0BEDD+wfM99cjsfx33e2 gX+AMnKBnG2HceoKdgsK5j/Ypww9a+QKG8eNLoRE84BvLXdDm60f4IShWklul2p/9uguZwh7V59pc uF6NMhha4vJlR9IedRIPTzSwOPQpJ/nHSSy/ubDUnG5GN08Xhirwibiws2j9wjU9PqrvZlmHxl05+ sh4L6CysA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6nv-0003I2-Uy; Tue, 01 Dec 2020 14:38:55 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6nt-0003HG-LM; Tue, 01 Dec 2020 14:38:54 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 1E32E1F44B45 Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code To: Dan Carpenter References: <20201201142754.GI2767@kadam> From: Helen Koike Message-ID: Date: Tue, 1 Dec 2020 11:38:33 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201201142754.GI2767@kadam> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_093853_825491_12426A75 X-CRM114-Status: GOOD ( 21.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dafna Hirschfeld , Heiko Stuebner , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Dan, On 12/1/20 11:27 AM, Dan Carpenter wrote: > On Mon, Nov 30, 2020 at 11:20:05AM -0300, Helen Koike wrote: >> Hi Dan, >> >> Thank you for your patch. >> >> On 11/30/20 9:53 AM, Dan Carpenter wrote: >>> The debugfs_create_dir() function never returns NULLs. It's not supposed >>> to checked for errors in the normal case and there is no need to check >>> in this function so let's just delete this dead code. >>> >>> Signed-off-by: Dan Carpenter >>> --- >>> drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 ---- >>> 1 file changed, 4 deletions(-) >>> >>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> index 9af137e4967f..68da1eed753d 100644 >>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >>> @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) >>> struct rkisp1_debug *debug = &rkisp1->debug; >>> >>> debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); >>> - if (!debug->debugfs_dir) { >>> - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); >>> - return; >>> - } >> >> I was taking a look at the debugfs_create_dir() code, and I saw it can >> return ERR_PTR(), so ideally we should check for errors with IS_ERR() / PTR_ERR(). > > Debugfs functions aren't meant to be error checked in the normal case. > There are some drivers which dereference the dentry pointer so those > need to check it but that's not very common and isn't the case here. right, I just saw the functions in inode.c already checks the parent with IS_ERR(). the debugfs_create_*() function calls start_creating() which already checks the parent. ok, fair enough, I'll ack v2. Regards, Helen > > I'm really sure this must be documented somewhere but I can't find it > at all. :P But look at commit 057e212eae72 ("media: usb: uvc: no need > to check return value of debugfs_create functions") for example. > > regards, > dan carpenter > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel