media: cec: no need to check return value of debugfs_create functions
Subsystems (5)
PATCH 1/7 media: cec: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/media/cec/core/cec-core.c | 27 ++++++++------------------- include/media/cec.h | 2 -- 2 files changed, 8 insertions(+), 21 deletions(-)
drivers/media/cec/core/cec-core.c +8 -19
@@ -359,27 +359,16 @@ int cec_register_adapter(struct cec_adapter *adap,if (!top_cec_dir)return 0 ; - adap->cec_dir =debugfs_create_dir (dev_name (&adap->devnode.dev), top_cec_dir); -if (IS_ERR_OR_NULL (adap->cec_dir)) { -pr_warn ("cec-%s: Failed to create debugfs dir\n" , adap->name); -return 0 ; - } - adap->status_file =debugfs_create_devm_seqfile (&adap->devnode.dev, -"status" , adap->cec_dir, cec_adap_status); -if (IS_ERR_OR_NULL (adap->status_file)) { -pr_warn ("cec-%s: Failed to create status file\n" , adap->name); -debugfs_remove_recursive (adap->cec_dir); - adap->cec_dir =NULL ; -return 0 ; - } + adap->cec_dir =debugfs_create_dir (dev_name (&adap->devnode.dev), + top_cec_dir); + +debugfs_create_devm_seqfile (&adap->devnode.dev,"status" , adap->cec_dir, + cec_adap_status); +if (!adap->ops->error_inj_show || !adap->ops->error_inj_parse_line)return 0 ; - adap->error_inj_file =debugfs_create_file ("error-inj" ,0644 , - adap->cec_dir, adap, - &cec_error_inj_fops); -if (IS_ERR_OR_NULL (adap->error_inj_file)) -pr_warn ("cec-%s: Failed to create error-inj file\n" , - adap->name); +debugfs_create_file ("error-inj" ,0644 , adap->cec_dir, adap, + &cec_error_inj_fops);#endif return 0 ; }
include/media/cec.h +0 -2
@@ -248,8 +248,6 @@ struct cec_adapter {#endif struct dentry *cec_dir; -struct dentry *status_file; -struct dentry *error_inj_file;u32 sequence;
Signature · 1 line
2.28.0
PATCH 2/7 media: coda: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/media/platform/coda/coda-common.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/platform/coda/coda-common.c +0 -5
@@ -1937,9 +1937,6 @@ int coda_alloc_aux_buf(struct coda_dev *dev, struct coda_aux_buf *buf, buf->blob.size = size; buf->dentry =debugfs_create_blob (name,0644 , parent, &buf->blob); -if (!buf->dentry) -dev_warn (dev->dev, -"failed to create debugfs entry %s\n" , name); }return 0 ;
@@ -3211,8 +3208,6 @@ static int coda_probe(struct platform_device *pdev)ida_init (&dev->ida); dev->debugfs_root =debugfs_create_dir ("coda" ,NULL ); -if (!dev->debugfs_root) -dev_warn (&pdev->dev,"failed to create debugfs root\n" );/* allocate auxiliary per-device buffers for the BIT processor */ if (dev->devtype->product ==CODA_DX6 ) {
Signature · 1 line
2.28.0
Re: [PATCH 2/7] media: coda: no need to check return value of debugfs_create functions
Quoted 9 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Cc Philipp Zabel <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Thank you,
regards
Philipp
Quoted 27 lines
--- drivers/media/platform/coda/coda-common.c | 5 ----- 1 file changed, 5 deletions(-)drivers/media/platform/coda/coda-common.c +0
-5@@ -1937,9 +1937,6 @@ int coda_alloc_aux_buf(struct coda_dev *dev, struct coda_aux_buf *buf, buf->blob.size = size; buf->dentry =debugfs_create_blob (name,0644 , parent, &buf->blob); -if (!buf->dentry) -dev_warn (dev->dev, -"failed to create debugfs entry %s\n" , name); }return 0 ;@@ -3211,8 +3208,6 @@ static int coda_probe(struct platform_device *pdev)ida_init (&dev->ida); dev->debugfs_root =debugfs_create_dir ("coda" ,NULL ); -if (!dev->debugfs_root) -dev_warn (&pdev->dev,"failed to create debugfs root\n" );/* allocate auxiliary per-device buffers for the BIT processor */ if (dev->devtype->product ==CODA_DX6 ) {
PATCH 3/7 media: exynos4-is: no need to check return value of debugfs_create functions
In reply to Greg Kroah-HartmanWhen calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/media/platform/exynos4-is/fimc-is.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/media/platform/exynos4-is/fimc-is.c +4 -13
@@ -756,18 +756,12 @@ static void fimc_is_debugfs_remove(struct fimc_is *is) is->debugfs_entry =NULL ; } -static int fimc_is_debugfs_create (struct fimc_is *is) +static void fimc_is_debugfs_create (struct fimc_is *is) { -struct dentry *dentry; - is->debugfs_entry =debugfs_create_dir ("fimc_is" ,NULL ); - dentry =debugfs_create_file ("fw_log" ,S_IRUGO , is->debugfs_entry, - is, &fimc_is_fops); -if (!dentry) -fimc_is_debugfs_remove (is); - -return is->debugfs_entry ==NULL ? -EIO :0 ; +debugfs_create_file ("fw_log" ,S_IRUGO , is->debugfs_entry, is, + &fimc_is_fops); }static int fimc_is_runtime_resume (struct device *dev);
@@ -853,9 +847,7 @@ static int fimc_is_probe(struct platform_device *pdev)if (ret <0 ) goto err_pm; - ret =fimc_is_debugfs_create (is); -if (ret <0 ) - goto err_sd; +fimc_is_debugfs_create (is); ret =fimc_is_request_firmware (is,FIMC_IS_FW_FILENAME );if (ret <0 )
@@ -868,7 +860,6 @@ static int fimc_is_probe(struct platform_device *pdev) err_dfs:fimc_is_debugfs_remove (is); -err_sd:fimc_is_unregister_subdevs (is); err_pm:pm_runtime_put_noidle (dev);
Signature · 1 line
2.28.0
PATCH 4/7 media: mtk-vpu: no need to check return value of debugfs_create functions
In reply to Greg Kroah-HartmanWhen calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/media/platform/mtk-vpu/mtk_vpu.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/platform/mtk-vpu/mtk_vpu.c +0 -5
@@ -849,10 +849,6 @@ static int mtk_vpu_probe(struct platform_device *pdev)#ifdef CONFIG_DEBUG_FS vpu_debugfs =debugfs_create_file ("mtk_vpu" ,S_IRUGO ,NULL , (void *)dev, &vpu_debug_fops); -if (!vpu_debugfs) { - ret = -ENOMEM ; - goto cleanup_ipi; - }#endif /* Set PTCM to 96K and DTCM to 32K */
@@ -910,7 +906,6 @@ static int mtk_vpu_probe(struct platform_device *pdev)of_reserved_mem_device_release (dev);#ifdef CONFIG_DEBUG_FS debugfs_remove (vpu_debugfs); -cleanup_ipi:#endif memset (vpu->ipi_desc,0 ,sizeof (struct vpu_ipi_desc ) *IPI_MAX ); vpu_mutex_destroy:
Signature · 1 line
2.28.0
PATCH 5/7 media: sti: no need to check return value of debugfs_create functions
In reply to Greg Kroah-HartmanWhen calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- .../media/platform/sti/bdisp/bdisp-debug.c | 29 ++++--------------- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 7 +---- drivers/media/platform/sti/bdisp/bdisp.h | 2 +- drivers/media/platform/sti/hva/hva-debugfs.c | 22 +++----------- 4 files changed, 12 insertions(+), 48 deletions(-)
drivers/media/platform/sti/bdisp/bdisp-debug.c +6 -23
@@ -637,35 +637,18 @@ DEFINE_SHOW_ATTRIBUTE(last_nodes_raw);DEFINE_SHOW_ATTRIBUTE (last_request);DEFINE_SHOW_ATTRIBUTE (perf); -int bdisp_debugfs_create (struct bdisp_dev *bdisp) +void bdisp_debugfs_create (struct bdisp_dev *bdisp) {char dirname[16 ];snprintf (dirname,sizeof (dirname),"%s%d" ,BDISP_NAME , bdisp->id); bdisp->dbg.debugfs_entry =debugfs_create_dir (dirname,NULL ); -if (!bdisp->dbg.debugfs_entry) - goto err; -if (!bdisp_dbg_create_entry (regs)) - goto err; - -if (!bdisp_dbg_create_entry (last_nodes)) - goto err; - -if (!bdisp_dbg_create_entry (last_nodes_raw)) - goto err; - -if (!bdisp_dbg_create_entry (last_request)) - goto err; - -if (!bdisp_dbg_create_entry (perf)) - goto err; - -return 0 ; - -err: -bdisp_debugfs_remove (bdisp); -return -ENOMEM ; +bdisp_dbg_create_entry (regs); +bdisp_dbg_create_entry (last_nodes); +bdisp_dbg_create_entry (last_nodes_raw); +bdisp_dbg_create_entry (last_request); +bdisp_dbg_create_entry (perf); }void bdisp_debugfs_remove (struct bdisp_dev *bdisp)
drivers/media/platform/sti/bdisp/bdisp-v4l2.c +1 -6
@@ -1360,11 +1360,7 @@ static int bdisp_probe(struct platform_device *pdev) }/* Debug */ - ret =bdisp_debugfs_create (bdisp); -if (ret) { -dev_err (dev,"failed to create debugfs\n" ); - goto err_v4l2; - } +bdisp_debugfs_create (bdisp);/* Power management */ pm_runtime_enable (dev);
@@ -1401,7 +1397,6 @@ static int bdisp_probe(struct platform_device *pdev)pm_runtime_put (dev); err_dbg:bdisp_debugfs_remove (bdisp); -err_v4l2:v4l2_device_unregister (&bdisp->v4l2_dev); err_clk:if (!IS_ERR (bdisp->clock))
drivers/media/platform/sti/bdisp/bdisp.h +1 -1
@@ -209,6 +209,6 @@ int bdisp_hw_get_and_clear_irq(struct bdisp_dev *bdisp);int bdisp_hw_update (struct bdisp_ctx *ctx);void bdisp_debugfs_remove (struct bdisp_dev *bdisp); -int bdisp_debugfs_create (struct bdisp_dev *bdisp); +void bdisp_debugfs_create (struct bdisp_dev *bdisp);void bdisp_dbg_perf_begin (struct bdisp_dev *bdisp);void bdisp_dbg_perf_end (struct bdisp_dev *bdisp);
drivers/media/platform/sti/hva/hva-debugfs.c +4 -18
@@ -337,25 +337,11 @@ DEFINE_SHOW_ATTRIBUTE(regs);void hva_debugfs_create (struct hva_dev *hva) { hva->dbg.debugfs_entry =debugfs_create_dir (HVA_NAME ,NULL ); -if (!hva->dbg.debugfs_entry) - goto err; -if (!hva_dbg_create_entry (device)) - goto err; - -if (!hva_dbg_create_entry (encoders)) - goto err; - -if (!hva_dbg_create_entry (last)) - goto err; - -if (!hva_dbg_create_entry (regs)) - goto err; - -return ; - -err: -hva_debugfs_remove (hva); +hva_dbg_create_entry (device); +hva_dbg_create_entry (encoders); +hva_dbg_create_entry (last); +hva_dbg_create_entry (regs); }void hva_debugfs_remove (struct hva_dev *hva)
Signature · 1 line
2.28.0
PATCH 6/7 media: radio: si476x: no need to check return value of debugfs_create functions
In reply to Greg Kroah-HartmanWhen calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/media/radio/radio-si476x.c | 66 ++++++------------------------ 1 file changed, 13 insertions(+), 53 deletions(-)
drivers/media/radio/radio-si476x.c +13 -53
@@ -1344,60 +1344,24 @@ static const struct file_operations radio_rsq_primary_fops = { }; -static int si476x_radio_init_debugfs (struct si476x_radio *radio) +static void si476x_radio_init_debugfs (struct si476x_radio *radio) { -struct dentry *dentry; -int ret; + radio->debugfs =debugfs_create_dir (dev_name (radio->v4l2dev.dev),NULL ); - dentry =debugfs_create_dir (dev_name (radio->v4l2dev.dev),NULL ); -if (IS_ERR (dentry)) { - ret =PTR_ERR (dentry); - goto exit; - } - radio->debugfs = dentry; - - dentry =debugfs_create_file ("acf" ,S_IRUGO , - radio->debugfs, radio, &radio_acf_fops); -if (IS_ERR (dentry)) { - ret =PTR_ERR (dentry); - goto cleanup; - } +debugfs_create_file ("acf" ,S_IRUGO , radio->debugfs, radio, + &radio_acf_fops); - dentry =debugfs_create_file ("rds_blckcnt" ,S_IRUGO , - radio->debugfs, radio, - &radio_rds_blckcnt_fops); -if (IS_ERR (dentry)) { - ret =PTR_ERR (dentry); - goto cleanup; - } +debugfs_create_file ("rds_blckcnt" ,S_IRUGO , radio->debugfs, radio, + &radio_rds_blckcnt_fops); - dentry =debugfs_create_file ("agc" ,S_IRUGO , - radio->debugfs, radio, &radio_agc_fops); -if (IS_ERR (dentry)) { - ret =PTR_ERR (dentry); - goto cleanup; - } +debugfs_create_file ("agc" ,S_IRUGO , radio->debugfs, radio, + &radio_agc_fops); - dentry =debugfs_create_file ("rsq" ,S_IRUGO , - radio->debugfs, radio, &radio_rsq_fops); -if (IS_ERR (dentry)) { - ret =PTR_ERR (dentry); - goto cleanup; - } +debugfs_create_file ("rsq" ,S_IRUGO , radio->debugfs, radio, + &radio_rsq_fops); - dentry =debugfs_create_file ("rsq_primary" ,S_IRUGO , - radio->debugfs, radio, - &radio_rsq_primary_fops); -if (IS_ERR (dentry)) { - ret =PTR_ERR (dentry); - goto cleanup; - } - -return 0 ; -cleanup: -debugfs_remove_recursive (radio->debugfs); -exit: -return ret; +debugfs_create_file ("rsq_primary" ,S_IRUGO , radio->debugfs, radio, + &radio_rsq_primary_fops); }
@@ -1534,11 +1498,7 @@ static int si476x_radio_probe(struct platform_device *pdev) goto exit; } - rval =si476x_radio_init_debugfs (radio); -if (rval <0 ) { -dev_err (&pdev->dev,"Could not create debugfs interface\n" ); - goto exit; - } +si476x_radio_init_debugfs (radio);return 0 ; exit:
Signature · 1 line
2.28.0
PATCH 7/7 media: usb: uvc: no need to check return value of debugfs_create functions
In reply to Greg Kroah-HartmanWhen calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/media/usb/uvc/uvc_debugfs.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/media/usb/uvc/uvc_debugfs.c +4 -16
@@ -73,7 +73,6 @@ static struct dentry *uvc_debugfs_root_dir;void uvc_debugfs_init_stream (struct uvc_streaming *stream) {struct usb_device *udev = stream->dev->udev; -struct dentry *dent;char dir_name[33 ];if (uvc_debugfs_root_dir ==NULL )
@@ -82,22 +81,11 @@ void uvc_debugfs_init_stream(struct uvc_streaming *stream)snprintf (dir_name,sizeof (dir_name),"%u-%u-%u" , udev->bus->busnum, udev->devnum, stream->intfnum); - dent =debugfs_create_dir (dir_name, uvc_debugfs_root_dir); -if (IS_ERR_OR_NULL (dent)) { -uvc_printk (KERN_INFO ,"Unable to create debugfs %s " -"directory.\n" , dir_name); -return ; - } - - stream->debugfs_dir = dent; + stream->debugfs_dir =debugfs_create_dir (dir_name, + uvc_debugfs_root_dir); - dent =debugfs_create_file ("stats" ,0444 , stream->debugfs_dir, - stream, &uvc_debugfs_stats_fops); -if (IS_ERR_OR_NULL (dent)) { -uvc_printk (KERN_INFO ,"Unable to create debugfs stats file.\n" ); -uvc_debugfs_cleanup_stream (stream); -return ; - } +debugfs_create_file ("stats" ,0444 , stream->debugfs_dir, stream, + &uvc_debugfs_stats_fops); }void uvc_debugfs_cleanup_stream (struct uvc_streaming *stream)
Signature · 1 line
2.28.0
Laurent Pinchart
maintainerRe: [PATCH 7/7] media: usb: uvc: no need to check return value of debugfs_create functions
Hi Greg,
Thank you for the patch.
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Is there no value in warning the user that something went wrong ? Silent failures are harder to debug.
Quoted 48 lines
Cc Laurent Pinchart <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/media/usb/uvc/uvc_debugfs.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)drivers/media/usb/uvc/uvc_debugfs.c +4
-16@@ -73,7 +73,6 @@ static struct dentry *uvc_debugfs_root_dir;void uvc_debugfs_init_stream (struct uvc_streaming *stream) {struct usb_device *udev = stream->dev->udev; -struct dentry *dent;char dir_name[33 ];if (uvc_debugfs_root_dir ==NULL )@@ -82,22 +81,11 @@ void uvc_debugfs_init_stream(struct uvc_streaming *stream)snprintf (dir_name,sizeof (dir_name),"%u-%u-%u" , udev->bus->busnum, udev->devnum, stream->intfnum); - dent =debugfs_create_dir (dir_name, uvc_debugfs_root_dir); -if (IS_ERR_OR_NULL (dent)) { -uvc_printk (KERN_INFO ,"Unable to create debugfs %s " -"directory.\n" , dir_name); -return ; - } - - stream->debugfs_dir = dent; + stream->debugfs_dir =debugfs_create_dir (dir_name, + uvc_debugfs_root_dir); - dent =debugfs_create_file ("stats" ,0444 , stream->debugfs_dir, - stream, &uvc_debugfs_stats_fops); -if (IS_ERR_OR_NULL (dent)) { -uvc_printk (KERN_INFO ,"Unable to create debugfs stats file.\n" ); -uvc_debugfs_cleanup_stream (stream); -return ; - } +debugfs_create_file ("stats" ,0444 , stream->debugfs_dir, stream, + &uvc_debugfs_stats_fops); }void uvc_debugfs_cleanup_stream (struct uvc_streaming *stream)
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerRe: [PATCH 7/7] media: usb: uvc: no need to check return value of debugfs_create functions
Hi Greg,
Quoted 11 lines · Laurent Pinchart
Hi Greg,
Thank you for the patch.
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Is there no value in warning the user that something went wrong ? Silent failures are harder to debug.
Could yous share your opinion about this ?
Quoted 48 lines
Quoted 48 lines
Cc Laurent Pinchart <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/media/usb/uvc/uvc_debugfs.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)drivers/media/usb/uvc/uvc_debugfs.c +4
-16@@ -73,7 +73,6 @@ static struct dentry *uvc_debugfs_root_dir;void uvc_debugfs_init_stream (struct uvc_streaming *stream) {struct usb_device *udev = stream->dev->udev; -struct dentry *dent;char dir_name[33 ];if (uvc_debugfs_root_dir ==NULL )@@ -82,22 +81,11 @@ void uvc_debugfs_init_stream(struct uvc_streaming *stream)snprintf (dir_name,sizeof (dir_name),"%u-%u-%u" , udev->bus->busnum, udev->devnum, stream->intfnum); - dent =debugfs_create_dir (dir_name, uvc_debugfs_root_dir); -if (IS_ERR_OR_NULL (dent)) { -uvc_printk (KERN_INFO ,"Unable to create debugfs %s " -"directory.\n" , dir_name); -return ; - } - - stream->debugfs_dir = dent; + stream->debugfs_dir =debugfs_create_dir (dir_name, + uvc_debugfs_root_dir); - dent =debugfs_create_file ("stats" ,0444 , stream->debugfs_dir, - stream, &uvc_debugfs_stats_fops); -if (IS_ERR_OR_NULL (dent)) { -uvc_printk (KERN_INFO ,"Unable to create debugfs stats file.\n" ); -uvc_debugfs_cleanup_stream (stream); -return ; - } +debugfs_create_file ("stats" ,0444 , stream->debugfs_dir, stream, + &uvc_debugfs_stats_fops); }void uvc_debugfs_cleanup_stream (struct uvc_streaming *stream)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 7/7] media: usb: uvc: no need to check return value of debugfs_create functions
Quoted 8 lines · Laurent Pinchart
Hi Greg,
Quoted 5 lines · Laurent Pinchart
Hi Greg,
Thank you for the patch.
On Tue, Aug 18, 2020 at 03:36:08PM +0200, Greg Kroah-Hartman wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Is there no value in warning the user that something went wrong ? Silent failures are harder to debug.
Could yous share your opinion about this ?
For debugfs, this isn't an issue, what can a user do with something like "debugfs isn't working? What does that mean???"
And if we _really_ want warnings like this, it should go into the debugfs core, not require this to be done for every debugfs user, right?
debugfs is just there for kernel developers to help debug things, it's not a dependancy on any userspace functionality, so if it works or not should not be an issue for any user.
Unless that user is a kernel developer of course :)
thanks,
greg k-h
Laurent Pinchart
maintainerRe: [PATCH 7/7] media: usb: uvc: no need to check return value of debugfs_create functions
Hi Greg,
Quoted 15 lines · Greg Kroah-Hartman
Quoted 10 lines · Laurent Pinchart
Quoted 7 lines · Laurent Pinchart
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Is there no value in warning the user that something went wrong ? Silent failures are harder to debug.
Could yous share your opinion about this ?
For debugfs, this isn't an issue, what can a user do with something like "debugfs isn't working? What does that mean???"
Quoted 8 lines
And if we _really_ want warnings like this, it should go into the debugfs core, not require this to be done for every debugfs user, right?
debugfs is just there for kernel developers to help debug things, it's not a dependancy on any userspace functionality, so if it works or not should not be an issue for any user.
Unless that user is a kernel developer of course :)
Exactly my point :-)
I'm fine moving the error message to the debugfs core itself instead of duplicating it in drivers. Maybe it's already there though, I haven't checked. Not printing any message isn't a great idea in my opinion, it makes debugging more difficult. I can't count the number of times where I've had to add printk's and recompile the kernel to debug issues that really should have generated at least a dev_dbg().
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 7/7] media: usb: uvc: no need to check return value of debugfs_create functions
Quoted 27 lines · Laurent Pinchart
Hi Greg,
Quoted 15 lines · Greg Kroah-Hartman
Quoted 10 lines · Laurent Pinchart
Quoted 7 lines · Laurent Pinchart
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Is there no value in warning the user that something went wrong ? Silent failures are harder to debug.
Could yous share your opinion about this ?
For debugfs, this isn't an issue, what can a user do with something like "debugfs isn't working? What does that mean???"
Quoted 8 lines
And if we _really_ want warnings like this, it should go into the debugfs core, not require this to be done for every debugfs user, right?
debugfs is just there for kernel developers to help debug things, it's not a dependancy on any userspace functionality, so if it works or not should not be an issue for any user.
Unless that user is a kernel developer of course :)
Quoted 8 lines
Exactly my point :-)
I'm fine moving the error message to the debugfs core itself instead of duplicating it in drivers. Maybe it's already there though, I haven't checked. Not printing any message isn't a great idea in my opinion, it makes debugging more difficult. I can't count the number of times where I've had to add printk's and recompile the kernel to debug issues that really should have generated at least a
dev_dbg().
There are a lot of error messages that debugfs will print out if it can not create a file:
inode.c 329 pr_err("Unable to pin filesystem for file '%s'\n", name); inode.c 348 pr_err("Directory '%s' with parent '%s' already present!\n", inode.c 351 pr_err("File '%s' in directory '%s' already present!\n", inode.c 402 pr_err("out of free dentries, can not create file '%s'\n", inode.c 563 pr_err("out of free dentries, can not create directory '%s'\n", inode.c 610 pr_err("out of free dentries, can not create automount '%s'\n", inode.c 668 pr_err("out of free dentries, can not create symlink '%s'\n",
So I think you are safe here. If we are missing any, I'll gladly add them.
Also given that you've never noticed this being a real error, means it's probably not an issue :)
thanks,
greg k-h