drivers/video/aty/radeon_base.c: compilation warning fix
Subsystems (2)
PATCH 1/1 drivers/video/aty/radeon_base.c: compilation warning fix
From: Leonardo Potenza <[email protected]>
Added a check for the sysfs_create_bin_file() return value
---
The aim of this patch is to remove the following warning messages:drivers/video/aty/radeon_base.c: In function 'radeonfb_pci_register':drivers/video/aty/radeon_base.c:2334: warning: ignoring return value of 'sysfs_create_bin_file', declared with attribute warn_unused_result drivers/video/aty/radeon_base.c:2336: warning: ignoring return value of 'sysfs_create_bin_file', declared with attribute warn_unused_result
drivers/video/aty/radeon_base.c +24 -6
@@ -2329,11 +2329,23 @@ static int __devinit radeonfb_pci_regist/* Build mode list, check out panel native model */ radeon_check_modes (rinfo, mode_option); -/* Register some sysfs stuff (should be done better) */ -if (rinfo->mon1_EDID) -sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid1_attr); -if (rinfo->mon2_EDID) -sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid2_attr); +/* Register some sysfs stuff */ +if (rinfo->mon1_EDID) { + ret =sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid1_attr); +if (ret !=0 ) { +printk (KERN_ERR "radeonfb (%s): cannot create edid1 bin file\n" , +pci_name (rinfo->pdev)); + goto err_unmap_fb; + } + } +if (rinfo->mon2_EDID) { + ret =sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid2_attr); +if (ret !=0 ) { +printk (KERN_ERR "radeonfb (%s): cannot create edid2 bin file\n" , +pci_name (rinfo->pdev)); + goto err_remove_edid1_file; + } + }/* save current mode regs before we switch into the new one * so we can restore this upon __exit
@@ -2357,7 +2369,7 @@ static int __devinit radeonfb_pci_registif (ret <0 ) {printk (KERN_ERR "radeonfb (%s): could not register framebuffer\n" ,pci_name (rinfo->pdev)); - goto err_unmap_fb; + goto err_remove_edid2_file; }#ifdef CONFIG_MTRR
@@ -2376,6 +2388,12 @@ static int __devinit radeonfb_pci_registRTRACE ("radeonfb_pci_register END\n" );return 0 ; +err_remove_edid2_file: +if (rinfo->mon2_EDID) +sysfs_remove_bin_file (&rinfo->pdev->dev.kobj, &edid2_attr); +err_remove_edid1_file: +if (rinfo->mon1_EDID) +sysfs_remove_bin_file (&rinfo->pdev->dev.kobj, &edid1_attr); err_unmap_fb:iounmap (rinfo->fb_base); err_unmap_rom:
Re: [PATCH] drivers/video/aty/radeon_base.c: compilation warning
Quoted 5 lines · Leonardo Potenza
From: Leonardo Potenza <[email protected]>
Added a check for the
sysfs_create_bin_file()return valueSigned-off-by Leonardo Potenza <[email protected]>
NACK.
The warnings are stupid, this is a long argument we had with akpm among others, I totally refuse to fail creating the framebuffer because something went bonkers creating some sysfs file that are in no way mandatory for the good operations of the fb.
There is a _shitload_ of cases where testing the result of those sysfs calls is pure bloat.
Ben.
Quoted 59 lines
The aim of this patch is to remove the following warning messages:
drivers/video/aty/radeon_base.c: In function 'radeonfb_pci_register':drivers/video/aty/radeon_base.c:2334: warning: ignoring return value of 'sysfs_create_bin_file', declared with attributewarn_unused_resultdrivers/video/aty/radeon_base.c:2336: warning: ignoring return value of 'sysfs_create_bin_file', declared with attributewarn_unused_resultdrivers/video/aty/radeon_base.c +24
-6@@ -2329,11 +2329,23 @@ static int __devinit radeonfb_pci_regist/* Build mode list, check out panel native model */ radeon_check_modes (rinfo, mode_option); -/* Register some sysfs stuff (should be done better) */ -if (rinfo->mon1_EDID) -sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid1_attr); -if (rinfo->mon2_EDID) -sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid2_attr); +/* Register some sysfs stuff */ +if (rinfo->mon1_EDID) { + ret =sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid1_attr); +if (ret !=0 ) { +printk (KERN_ERR "radeonfb (%s): cannot create edid1 bin file\n" , +pci_name (rinfo->pdev)); + goto err_unmap_fb; + } + } +if (rinfo->mon2_EDID) { + ret =sysfs_create_bin_file (&rinfo->pdev->dev.kobj, &edid2_attr); +if (ret !=0 ) { +printk (KERN_ERR "radeonfb (%s): cannot create edid2 bin file\n" , +pci_name (rinfo->pdev)); + goto err_remove_edid1_file; + } + }/* save current mode regs before we switch into the new one * so we can restore this upon __exit @@ -2357,7 +2369,7 @@ static int __devinit radeonfb_pci_registif (ret <0 ) {printk (KERN_ERR "radeonfb (%s): could not register framebuffer\n" ,pci_name (rinfo->pdev)); - goto err_unmap_fb; + goto err_remove_edid2_file; }#ifdef CONFIG_MTRR @@ -2376,6 +2388,12 @@ static int __devinit radeonfb_pci_registRTRACE ("radeonfb_pci_register END\n" );return 0 ; +err_remove_edid2_file: +if (rinfo->mon2_EDID) +sysfs_remove_bin_file (&rinfo->pdev->dev.kobj, &edid2_attr); +err_remove_edid1_file: +if (rinfo->mon1_EDID) +sysfs_remove_bin_file (&rinfo->pdev->dev.kobj, &edid1_attr); err_unmap_fb:iounmap (rinfo->fb_base); err_unmap_rom:
Quoted 15 lines · On Wednesday 02 January 2008 21:19:33 Benjamin Herrenschmidt wrote:
Quoted 5 lines · Leonardo Potenza
From: Leonardo Potenza <[email protected]>
Added a check for the
sysfs_create_bin_file()return valueSigned-off-by Leonardo Potenza <[email protected]>NACK.
The warnings are stupid, this is a long argument we had with akpm among others, I totally refuse to fail creating the framebuffer because something went bonkers creating some sysfs file that are in no way mandatory for the good operations of the fb.
Quoted 4 lines
There is a _shitload_ of cases where testing the result of those sysfs calls is pure bloat.
Ben.
Sorry, I missed the former discussion.
Do you think that a solution like:
[...]
if (rinfo->mon1_EDID) {
ret = sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr);
if (ret != 0)
printk( KERN_WARNING "radeonfb (%s): cannot create edid1 bin file\n",
pci_name(rinfo->pdev));
}[...]
would be acceptable in this case?
If you agree, I could re-submit the patch modified.
Thanks.
Leonardo
Re: [PATCH] drivers/video/aty/radeon_base.c: compilation warning
In reply to Leonardo PotenzaQuoted 10 lines
Do you think that a solution like:
[...]
if (rinfo->mon1_EDID) { ret = sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr); if (ret != 0) printk( KERN_WARNING "radeonfb (%s): cannot create edid1 bin file\n", pci_name(rinfo->pdev)); }
Quoted 5 lines
[...]
would be acceptable in this case?
If you agree, I could re-submit the patch modified.
Bloat bloat bloat...
Ben.
Re: [PATCH] drivers/video/aty/radeon_base.c: compilation warning
In reply to Leonardo PotenzaFrom: Benjamin Herrenschmidt <[email protected]>
Date: Thu, 03 Jan 2008 07:19:33 +1100
Quoted 10 lines · Leonardo Potenza
Quoted 5 lines
From: Leonardo Potenza <[email protected]>
Added a check for the
sysfs_create_bin_file()return valueSigned-off-by Leonardo Potenza <[email protected]>NACK.
Quoted 7 lines
The warnings are stupid, this is a long argument we had with akpm among others, I totally refuse to fail creating the framebuffer because something went bonkers creating some sysfs file that are in no way mandatory for the good operations of the fb.
There is a _shitload_ of cases where testing the result of those sysfs calls is pure bloat.
I agree.
In fact my first reaction to this patch is "Damn, I better test to make sure I don't lose my console on my workstation because of this stupid patch."
Just put (void)'s there or whatever, or we should get rid of the mustcheck annotations. Either way is fine with me.
Quoted 11 lines · On Thursday 03 January 2008 01:32:13 Benjamin Herrenschmidt wrote:
Quoted 11 lines
Do you think that a solution like:
[...]
if (rinfo->mon1_EDID) { ret = sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr); if (ret != 0) printk( KERN_WARNING "radeonfb (%s): cannot create edid1 bin file\n", pci_name(rinfo->pdev)); }[...]
Quoted 8 lines
Quoted 3 lines
would be acceptable in this case?
If you agree, I could re-submit the patch modified.
Bloat bloat bloat...
Ben.
I have to agree with you that my first proposal (avoid creating the framebuffer in case of a problem in the creation of a sysfs file) was a little bit "drastic" measure.
I thought that at least the user should be aware that something went wrong in the driver initialization and that not all the features will be available at run-time.
That's why I tried to add a specific warning message.
Anyway, I didn't intend to waste so much of your time with my patch submission.
Sorry for that.
Leonardo
Re: [PATCH] drivers/video/aty/radeon_base.c: compilation warning
In reply to Leonardo PotenzaQuoted 7 lines · Leonardo Potenza
I thought that at least the user should be aware that something went wrong in the driver initialization and that not all the features will be available at run-time.
That's why I tried to add a specific warning message.Anyway, I didn't intend to waste so much of your time with my patch submission.
The warning is annoying... see if you can find the shortest way in term of code bloat to get rid of it...
Cheers,
Ben.
Quoted 7 lines · On Thursday 03 January 2008 21:24:07 Benjamin Herrenschmidt wrote:
Quoted 5 lines · Leonardo Potenza
I thought that at least the user should be aware that something went wrong in the driver initialization and that not all the features will be available at run-time.
That's why I tried to add a specific warning message.
Quoted 9 lines
Quoted 2 lines
Anyway, I didn't intend to waste so much of your time with my patch submission.
The warning is annoying... see if you can find the shortest way in term of code bloat to get rid of it...
Cheers,
Ben.
Maybe something like:
if (rinfo->mon1_EDID) WARN_ON(sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr));
could suppress the compilation warning while keeping the generation of a warning message in case of error.
I wonder if this solution could be acceptable for you.
It doesn't sound too bloat to me, but maybe you were thinking about something completely different...
Leonardo
Re: [PATCH] drivers/video/aty/radeon_base.c: compilation warning
In reply to Leonardo PotenzaQuoted 11 lines
if (rinfo->mon1_EDID) WARN_ON(sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr));could suppress the compilation warning while keeping the generation of a warning message in case of error.
I wonder if this solution could be acceptable for you.
It doesn't sound too bloat to me, but maybe you were thinking about something completely different...
That would be allright I suppose.
Ben.