mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 14:45:27 +00:00
media: mgb4: Fix debugfs error handling
Fix broken handling of debugfs_create_dir() errors including errors creating the parent mgb4(PCIe) device's debugfs directory. Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
4510319676
commit
9d31522aa5
@ -582,9 +582,7 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
mgbdev->debugfs = debugfs_create_dir(dev_name(&pdev->dev), NULL);
|
||||
#endif
|
||||
|
||||
/* Get card serial number. On systems without MTD flash support we may
|
||||
* get an error thus ignore the return value. An invalid serial number
|
||||
@ -646,6 +644,8 @@ static void mgb4_remove(struct pci_dev *pdev)
|
||||
hwmon_device_unregister(mgbdev->hwmon_dev);
|
||||
#endif
|
||||
|
||||
debugfs_remove_recursive(mgbdev->debugfs);
|
||||
|
||||
if (mgbdev->indio_dev)
|
||||
mgb4_trigger_free(mgbdev->indio_dev);
|
||||
|
||||
@ -656,10 +656,6 @@ static void mgb4_remove(struct pci_dev *pdev)
|
||||
if (mgbdev->vin[i])
|
||||
mgb4_vin_free(mgbdev->vin[i]);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_remove_recursive(mgbdev->debugfs);
|
||||
#endif
|
||||
|
||||
device_remove_groups(&mgbdev->pdev->dev, mgb4_pci_groups);
|
||||
free_spi(mgbdev);
|
||||
free_i2c(mgbdev);
|
||||
|
@ -68,9 +68,7 @@ struct mgb4_dev {
|
||||
u8 module_version;
|
||||
u32 serial_number;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -853,14 +853,16 @@ static void fpga_init(struct mgb4_vin_dev *vindev)
|
||||
mgb4_write_reg(video, regs->config, 1U << 9);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static void debugfs_init(struct mgb4_vin_dev *vindev)
|
||||
static void create_debugfs(struct mgb4_vin_dev *vindev)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct mgb4_regs *video = &vindev->mgbdev->video;
|
||||
struct dentry *entry;
|
||||
|
||||
vindev->debugfs = debugfs_create_dir(vindev->vdev.name,
|
||||
vindev->mgbdev->debugfs);
|
||||
if (!vindev->debugfs)
|
||||
if (IS_ERR_OR_NULL(vindev->mgbdev->debugfs))
|
||||
return;
|
||||
entry = debugfs_create_dir(vindev->vdev.name, vindev->mgbdev->debugfs);
|
||||
if (IS_ERR(entry))
|
||||
return;
|
||||
|
||||
vindev->regs[0].name = "CONFIG";
|
||||
@ -892,10 +894,9 @@ static void debugfs_init(struct mgb4_vin_dev *vindev)
|
||||
vindev->regset.base = video->membase;
|
||||
vindev->regset.regs = vindev->regs;
|
||||
|
||||
debugfs_create_regset32("registers", 0444, vindev->debugfs,
|
||||
&vindev->regset);
|
||||
}
|
||||
debugfs_create_regset32("registers", 0444, entry, &vindev->regset);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id)
|
||||
{
|
||||
@ -1001,9 +1002,7 @@ struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id)
|
||||
goto err_video_dev;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_init(vindev);
|
||||
#endif
|
||||
create_debugfs(vindev);
|
||||
|
||||
return vindev;
|
||||
|
||||
@ -1034,10 +1033,6 @@ void mgb4_vin_free(struct mgb4_vin_dev *vindev)
|
||||
free_irq(vin_irq, vindev);
|
||||
free_irq(err_irq, vindev);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_remove_recursive(vindev->debugfs);
|
||||
#endif
|
||||
|
||||
groups = MGB4_IS_GMSL(vindev->mgbdev)
|
||||
? mgb4_gmsl_in_groups : mgb4_fpdl3_in_groups;
|
||||
device_remove_groups(&vindev->vdev.dev, groups);
|
||||
|
@ -58,7 +58,6 @@ struct mgb4_vin_dev {
|
||||
const struct mgb4_vin_config *config;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs;
|
||||
struct debugfs_regset32 regset;
|
||||
struct debugfs_reg32 regs[sizeof(struct mgb4_vin_regs) / 4];
|
||||
#endif
|
||||
|
@ -676,14 +676,16 @@ static void fpga_init(struct mgb4_vout_dev *voutdev)
|
||||
(voutdev->config->id + MGB4_VIN_DEVICES) << 2 | 1 << 4);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static void debugfs_init(struct mgb4_vout_dev *voutdev)
|
||||
static void create_debugfs(struct mgb4_vout_dev *voutdev)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct mgb4_regs *video = &voutdev->mgbdev->video;
|
||||
struct dentry *entry;
|
||||
|
||||
voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name,
|
||||
voutdev->mgbdev->debugfs);
|
||||
if (!voutdev->debugfs)
|
||||
if (IS_ERR_OR_NULL(voutdev->mgbdev->debugfs))
|
||||
return;
|
||||
entry = debugfs_create_dir(voutdev->vdev.name, voutdev->mgbdev->debugfs);
|
||||
if (IS_ERR(entry))
|
||||
return;
|
||||
|
||||
voutdev->regs[0].name = "CONFIG";
|
||||
@ -711,10 +713,9 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev)
|
||||
voutdev->regset.base = video->membase;
|
||||
voutdev->regset.regs = voutdev->regs;
|
||||
|
||||
debugfs_create_regset32("registers", 0444, voutdev->debugfs,
|
||||
&voutdev->regset);
|
||||
}
|
||||
debugfs_create_regset32("registers", 0444, entry, &voutdev->regset);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct mgb4_vout_dev *mgb4_vout_create(struct mgb4_dev *mgbdev, int id)
|
||||
{
|
||||
@ -808,9 +809,7 @@ struct mgb4_vout_dev *mgb4_vout_create(struct mgb4_dev *mgbdev, int id)
|
||||
goto err_video_dev;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_init(voutdev);
|
||||
#endif
|
||||
create_debugfs(voutdev);
|
||||
|
||||
return voutdev;
|
||||
|
||||
@ -833,10 +832,6 @@ void mgb4_vout_free(struct mgb4_vout_dev *voutdev)
|
||||
|
||||
free_irq(irq, voutdev);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_remove_recursive(voutdev->debugfs);
|
||||
#endif
|
||||
|
||||
groups = MGB4_IS_GMSL(voutdev->mgbdev)
|
||||
? mgb4_gmsl_out_groups : mgb4_fpdl3_out_groups;
|
||||
device_remove_groups(&voutdev->vdev.dev, groups);
|
||||
|
@ -54,7 +54,6 @@ struct mgb4_vout_dev {
|
||||
const struct mgb4_vout_config *config;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs;
|
||||
struct debugfs_regset32 regset;
|
||||
struct debugfs_reg32 regs[sizeof(struct mgb4_vout_regs) / 4];
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user