All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helen Koike <helen.koike@collabora.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	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
Date: Tue, 1 Dec 2020 11:38:33 -0300	[thread overview]
Message-ID: <cedd1dd1-36c5-ff63-4092-e5f6b40e6286@collabora.com> (raw)
In-Reply-To: <20201201142754.GI2767@kadam>

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 <dan.carpenter@oracle.com>
>>> ---
>>>  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
> 

WARNING: multiple messages have this Message-ID (diff)
From: Helen Koike <helen.koike@collabora.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Heiko Stuebner <heiko@sntech.de>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code
Date: Tue, 01 Dec 2020 14:38:33 +0000	[thread overview]
Message-ID: <cedd1dd1-36c5-ff63-4092-e5f6b40e6286@collabora.com> (raw)
In-Reply-To: <20201201142754.GI2767@kadam>

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 <dan.carpenter@oracle.com>
>>> ---
>>>  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
> 

WARNING: multiple messages have this Message-ID (diff)
From: Helen Koike <helen.koike@collabora.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Heiko Stuebner <heiko@sntech.de>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code
Date: Tue, 1 Dec 2020 11:38:33 -0300	[thread overview]
Message-ID: <cedd1dd1-36c5-ff63-4092-e5f6b40e6286@collabora.com> (raw)
In-Reply-To: <20201201142754.GI2767@kadam>

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 <dan.carpenter@oracle.com>
>>> ---
>>>  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

WARNING: multiple messages have this Message-ID (diff)
From: Helen Koike <helen.koike@collabora.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Heiko Stuebner <heiko@sntech.de>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] media: rockchip: rkisp1: remove some dead code
Date: Tue, 1 Dec 2020 11:38:33 -0300	[thread overview]
Message-ID: <cedd1dd1-36c5-ff63-4092-e5f6b40e6286@collabora.com> (raw)
In-Reply-To: <20201201142754.GI2767@kadam>

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 <dan.carpenter@oracle.com>
>>> ---
>>>  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

  reply	other threads:[~2020-12-01 14:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 12:53 [PATCH] media: rockchip: rkisp1: remove some dead code Dan Carpenter
2020-11-30 12:53 ` Dan Carpenter
2020-11-30 12:53 ` Dan Carpenter
2020-11-30 12:53 ` Dan Carpenter
2020-11-30 14:20 ` Helen Koike
2020-11-30 14:20   ` Helen Koike
2020-11-30 14:20   ` Helen Koike
2020-11-30 14:20   ` Helen Koike
2020-12-01 14:27   ` Dan Carpenter
2020-12-01 14:27     ` Dan Carpenter
2020-12-01 14:27     ` Dan Carpenter
2020-12-01 14:27     ` Dan Carpenter
2020-12-01 14:38     ` Helen Koike [this message]
2020-12-01 14:38       ` Helen Koike
2020-12-01 14:38       ` Helen Koike
2020-12-01 14:38       ` Helen Koike
2020-12-01 14:30   ` [PATCH v2] media: rockchip: rkisp1: remove useless debugfs checks Dan Carpenter
2020-12-01 14:30     ` Dan Carpenter
2020-12-01 14:30     ` Dan Carpenter
2020-12-01 14:30     ` Dan Carpenter
2020-12-01 14:39     ` Helen Koike
2020-12-01 14:39       ` Helen Koike
2020-12-01 14:39       ` Helen Koike
2020-12-01 14:39       ` Helen Koike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cedd1dd1-36c5-ff63-4092-e5f6b40e6286@collabora.com \
    --to=helen.koike@collabora.com \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=dan.carpenter@oracle.com \
    --cc=heiko@sntech.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.