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=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,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 7D73AC71156 for ; Tue, 1 Dec 2020 14:29:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35C7320758 for ; Tue, 1 Dec 2020 14:29:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="fBDLhHqS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388303AbgLAO3A (ORCPT ); Tue, 1 Dec 2020 09:29:00 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:47932 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387713AbgLAO27 (ORCPT ); Tue, 1 Dec 2020 09:28:59 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B1EPbKc066438; Tue, 1 Dec 2020 14:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=lSDu8t/HORP5DGvOJVpdFSL55t/SXzgnV5nxwvWbtpM=; b=fBDLhHqSvpikoiRVAKewNM5lZ+BAmcHZ8lrgKB2KDaoRrk7/JSKt7+qNVsJDYIFpWpee +ZqheuWD/Uz1PIcDSzNguIfirqyu2GwVUFRhBqFg4xfEb9S51jtt8tk/2zWKysOx+RXn rVJVZnUx3u+X7jKDFY/ZUBirXtCfh3tH3LiG8OpqzsBhaA80ltrvannqaq1EezII5mY4 pHI00AvViLwQ37Po/0LtAT97Ay/DloKvmhISctvTlWFaJRStLj9BcmFlpPPmdiFF6JNN lkzj4PLZ5q5xTPjta595lPHEXQgpRGvIOpTsWot0ZnFvD37+F3BSiLhfRyvmGq4q8+yk TQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 353dyqjsqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 01 Dec 2020 14:28:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B1ELKc0118032; Tue, 1 Dec 2020 14:28:06 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 3540fx0x2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Dec 2020 14:28:05 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0B1ES2Rs023619; Tue, 1 Dec 2020 14:28:03 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Dec 2020 06:28:01 -0800 Date: Tue, 1 Dec 2020 17:27:54 +0300 From: Dan Carpenter To: Helen Koike 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 Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code Message-ID: <20201201142754.GI2767@kadam> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9821 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010092 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9821 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010092 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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: Dan Carpenter Date: Tue, 01 Dec 2020 14:27:54 +0000 Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code Message-Id: <20201201142754.GI2767@kadam> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Helen Koike 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 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. 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,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 941E1C64E7A for ; Tue, 1 Dec 2020 14:28:22 +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 14A7320757 for ; Tue, 1 Dec 2020 14:28:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AcH6fN0b"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="fBDLhHqS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14A7320757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.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:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0wJdxE7JO95FiQJXt5XmKSriCOKNbGeG+mE9WznR9DE=; b=AcH6fN0bN23Jvk8a3klB5SWA0 jKK9cMmr3bmI/VNFIxnzV+6vhpVbL+k/pkPtzrgSbgSNkt/K7nhW+D1HjRNmWZrM/9XVQExc+Cgfc GVHrqJve6TuM+COV48qNSUNEQ1l2O3VrlLTuwAZsYQgorFOXi3ZR9mj3lpAul4CiKo9e0Cx97DBef Wwi6khIKPCXLHJ5HeP5LkT3Js9WLfJV9nTdQUULefsTNW2/v03FrSaGZvPTbH2V/xdizhp+pT//mz Hu2n/+gZWy5j86OmSAqAkmJgAqDeMI6HizpHysVMj/WUf1GSDksld0eSe5CtqsVymjXwhjcimV6d4 R0eRFRzgg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6dd-0001Mv-4e; Tue, 01 Dec 2020 14:28:17 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6da-0001Lg-8T; Tue, 01 Dec 2020 14:28:15 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B1EPbKc066438; Tue, 1 Dec 2020 14:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=lSDu8t/HORP5DGvOJVpdFSL55t/SXzgnV5nxwvWbtpM=; b=fBDLhHqSvpikoiRVAKewNM5lZ+BAmcHZ8lrgKB2KDaoRrk7/JSKt7+qNVsJDYIFpWpee +ZqheuWD/Uz1PIcDSzNguIfirqyu2GwVUFRhBqFg4xfEb9S51jtt8tk/2zWKysOx+RXn rVJVZnUx3u+X7jKDFY/ZUBirXtCfh3tH3LiG8OpqzsBhaA80ltrvannqaq1EezII5mY4 pHI00AvViLwQ37Po/0LtAT97Ay/DloKvmhISctvTlWFaJRStLj9BcmFlpPPmdiFF6JNN lkzj4PLZ5q5xTPjta595lPHEXQgpRGvIOpTsWot0ZnFvD37+F3BSiLhfRyvmGq4q8+yk TQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 353dyqjsqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 01 Dec 2020 14:28:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B1ELKc0118032; Tue, 1 Dec 2020 14:28:06 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 3540fx0x2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Dec 2020 14:28:05 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0B1ES2Rs023619; Tue, 1 Dec 2020 14:28:03 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Dec 2020 06:28:01 -0800 Date: Tue, 1 Dec 2020 17:27:54 +0300 From: Dan Carpenter To: Helen Koike Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code Message-ID: <20201201142754.GI2767@kadam> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9821 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010092 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9821 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010092 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_092814_481386_D3C6293D X-CRM114-Status: GOOD ( 29.82 ) 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 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. 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,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 890D1C64E7B for ; Tue, 1 Dec 2020 14:29:30 +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 F421220757 for ; Tue, 1 Dec 2020 14:29:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EKdJe6OS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="fBDLhHqS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F421220757 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.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:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=r4IhrZ733oiYYKA3liZNUcKcOgJzhW2k8fbUn7t9Uak=; b=EKdJe6OSA5K8lAejEHmOXvTZP W9z6JPeSIxTDrmAxCugUScPjN40soOB3ShNC7LAxKuBB7Rp06vrM6xYIWZejuGmGBixqT0+iyXG29 NPyxViEyw7M/d+2mUScsXwvpU2GaziAhYltJtclvIb3SezxokKZvXt1J/u/EIlf60e4a40XI5N05Q NdrL0hIn34TccGRchpMPpSyNVPbrTZG5+GK8vEOXhSdvobU6sMVJpLqUsXWKVvraGN9zhm0eZ7Bp8 X4BiLFzFZxUisOnKNhpAMd2bTAmdjxvkAm7fWrD/YosRY6O6Ffw8WvLuylPdphkld40lO0oC+lDic 4pShOdL1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6de-0001N7-3v; Tue, 01 Dec 2020 14:28:18 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk6da-0001Lg-8T; Tue, 01 Dec 2020 14:28:15 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B1EPbKc066438; Tue, 1 Dec 2020 14:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=lSDu8t/HORP5DGvOJVpdFSL55t/SXzgnV5nxwvWbtpM=; b=fBDLhHqSvpikoiRVAKewNM5lZ+BAmcHZ8lrgKB2KDaoRrk7/JSKt7+qNVsJDYIFpWpee +ZqheuWD/Uz1PIcDSzNguIfirqyu2GwVUFRhBqFg4xfEb9S51jtt8tk/2zWKysOx+RXn rVJVZnUx3u+X7jKDFY/ZUBirXtCfh3tH3LiG8OpqzsBhaA80ltrvannqaq1EezII5mY4 pHI00AvViLwQ37Po/0LtAT97Ay/DloKvmhISctvTlWFaJRStLj9BcmFlpPPmdiFF6JNN lkzj4PLZ5q5xTPjta595lPHEXQgpRGvIOpTsWot0ZnFvD37+F3BSiLhfRyvmGq4q8+yk TQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 353dyqjsqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 01 Dec 2020 14:28:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B1ELKc0118032; Tue, 1 Dec 2020 14:28:06 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 3540fx0x2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Dec 2020 14:28:05 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0B1ES2Rs023619; Tue, 1 Dec 2020 14:28:03 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Dec 2020 06:28:01 -0800 Date: Tue, 1 Dec 2020 17:27:54 +0300 From: Dan Carpenter To: Helen Koike Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code Message-ID: <20201201142754.GI2767@kadam> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9821 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010092 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9821 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010092 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_092814_481386_D3C6293D X-CRM114-Status: GOOD ( 29.82 ) 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 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. 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