Message ID | 20241023063638.241-1-thunder.leizhen@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/1] media: pci: mgb4: Fix return value check in debugfs_init() | expand |
On 23. 10. 24 8:36, Zhen Lei wrote: > Fix the incorrect return value check for debugfs_create_dir(), which > returns ERR_PTR(-ERROR) instead of NULL when it fails. > > Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver") > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > --- > drivers/media/pci/mgb4/mgb4_vin.c | 2 +- > drivers/media/pci/mgb4/mgb4_vout.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c > index e9332abb31729ea..808eb51b270c755 100644 > --- a/drivers/media/pci/mgb4/mgb4_vin.c > +++ b/drivers/media/pci/mgb4/mgb4_vin.c > @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev) > > vindev->debugfs = debugfs_create_dir(vindev->vdev.name, > vindev->mgbdev->debugfs); > - if (!vindev->debugfs) > + if (IS_ERR(vindev->debugfs)) > return; > > vindev->regs[0].name = "CONFIG"; > diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c > index 998edcbd972387d..348c8e01fcbed5a 100644 > --- a/drivers/media/pci/mgb4/mgb4_vout.c > +++ b/drivers/media/pci/mgb4/mgb4_vout.c > @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev) > > voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name, > voutdev->mgbdev->debugfs); > - if (!voutdev->debugfs) > + if (IS_ERR(voutdev->debugfs)) > return; > > voutdev->regs[0].name = "CONFIG"; This issue has already been addressed and fixed, see the v4l2 media.git branch: https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vin.c https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vout.c M.
On 23. 10. 24 11:04, Martin Tůma wrote: > On 23. 10. 24 8:36, Zhen Lei wrote: >> Fix the incorrect return value check for debugfs_create_dir(), which >> returns ERR_PTR(-ERROR) instead of NULL when it fails. >> >> Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 >> driver") >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >> --- >> drivers/media/pci/mgb4/mgb4_vin.c | 2 +- >> drivers/media/pci/mgb4/mgb4_vout.c | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/ >> mgb4/mgb4_vin.c >> index e9332abb31729ea..808eb51b270c755 100644 >> --- a/drivers/media/pci/mgb4/mgb4_vin.c >> +++ b/drivers/media/pci/mgb4/mgb4_vin.c >> @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev) >> vindev->debugfs = debugfs_create_dir(vindev->vdev.name, >> vindev->mgbdev->debugfs); >> - if (!vindev->debugfs) >> + if (IS_ERR(vindev->debugfs)) >> return; >> vindev->regs[0].name = "CONFIG"; >> diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/ >> mgb4/mgb4_vout.c >> index 998edcbd972387d..348c8e01fcbed5a 100644 >> --- a/drivers/media/pci/mgb4/mgb4_vout.c >> +++ b/drivers/media/pci/mgb4/mgb4_vout.c >> @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev >> *voutdev) >> voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name, >> voutdev->mgbdev->debugfs); >> - if (!voutdev->debugfs) >> + if (IS_ERR(voutdev->debugfs)) >> return; >> voutdev->regs[0].name = "CONFIG"; > > This issue has already been addressed and fixed, see the v4l2 media.git > branch: v4l2 media.git next branch > > https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vin.c > https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vout.c > > M. >
On 2024/10/23 17:18, Martin Tůma wrote: > On 23. 10. 24 11:04, Martin Tůma wrote: >> On 23. 10. 24 8:36, Zhen Lei wrote: >>> Fix the incorrect return value check for debugfs_create_dir(), which >>> returns ERR_PTR(-ERROR) instead of NULL when it fails. >>> >>> Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver") >>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >>> --- >>> drivers/media/pci/mgb4/mgb4_vin.c | 2 +- >>> drivers/media/pci/mgb4/mgb4_vout.c | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/ mgb4/mgb4_vin.c >>> index e9332abb31729ea..808eb51b270c755 100644 >>> --- a/drivers/media/pci/mgb4/mgb4_vin.c >>> +++ b/drivers/media/pci/mgb4/mgb4_vin.c >>> @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev) >>> vindev->debugfs = debugfs_create_dir(vindev->vdev.name, >>> vindev->mgbdev->debugfs); >>> - if (!vindev->debugfs) >>> + if (IS_ERR(vindev->debugfs)) >>> return; >>> vindev->regs[0].name = "CONFIG"; >>> diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/ mgb4/mgb4_vout.c >>> index 998edcbd972387d..348c8e01fcbed5a 100644 >>> --- a/drivers/media/pci/mgb4/mgb4_vout.c >>> +++ b/drivers/media/pci/mgb4/mgb4_vout.c >>> @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev) >>> voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name, >>> voutdev->mgbdev->debugfs); >>> - if (!voutdev->debugfs) >>> + if (IS_ERR(voutdev->debugfs)) >>> return; >>> voutdev->regs[0].name = "CONFIG"; >> >> This issue has already been addressed and fixed, see the v4l2 media.git branch: > > v4l2 media.git next branch OK, I see it, thanks. > >> >> https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vin.c https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vout.c >> >> M. >> > > . >
diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c index e9332abb31729ea..808eb51b270c755 100644 --- a/drivers/media/pci/mgb4/mgb4_vin.c +++ b/drivers/media/pci/mgb4/mgb4_vin.c @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev) vindev->debugfs = debugfs_create_dir(vindev->vdev.name, vindev->mgbdev->debugfs); - if (!vindev->debugfs) + if (IS_ERR(vindev->debugfs)) return; vindev->regs[0].name = "CONFIG"; diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c index 998edcbd972387d..348c8e01fcbed5a 100644 --- a/drivers/media/pci/mgb4/mgb4_vout.c +++ b/drivers/media/pci/mgb4/mgb4_vout.c @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev) voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name, voutdev->mgbdev->debugfs); - if (!voutdev->debugfs) + if (IS_ERR(voutdev->debugfs)) return; voutdev->regs[0].name = "CONFIG";
Fix the incorrect return value check for debugfs_create_dir(), which returns ERR_PTR(-ERROR) instead of NULL when it fails. Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver") Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/media/pci/mgb4/mgb4_vin.c | 2 +- drivers/media/pci/mgb4/mgb4_vout.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)