* [PATCH] aic94xx: fix handling of default CTRL-A settings
@ 2012-09-25 12:07 Paul Bolle
2012-10-29 10:42 ` Paul Bolle
0 siblings, 1 reply; 2+ messages in thread
From: Paul Bolle @ 2012-09-25 12:07 UTC (permalink / raw)
To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel
Compiling aic94xx_sds.o (part of the aic94xx driver) triggers this GCC
warning:
drivers/scsi/aic94xx/aic94xx_sds.c: In function 'asd_read_flash':
drivers/scsi/aic94xx/aic94xx_sds.c:597:21: warning: 'offs' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/scsi/aic94xx/aic94xx_sds.c:985:6: note: 'offs' was declared here
This warning can be traced back to asd_find_flash_de(). If it fails to
find a FLASH_DE_CTRL_A_USER entry it will return without setting 'offs'.
And that will leave 'offs' uninitialized when asd_read_flash_seg() is
called a little later.
But that call of asd_read_flash_seg() isn't needed in that case.
Everything this code cares about can already be found in the "default
CTRL-A user settings section" that was created in the error path. So
let's just jump over that call (and all other unneeded code) after
creating that section.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) I noticed this warning while building v3.6-rc7 on current Fedora
17, using Fedora's default config.
1) Compile tested only. It might be best to run test this too, if only
to test whether the non-error path is unaffected.
2) This piece of code has not been touched ever since it was added in
v2.6.19, with commit 2908d778ab3e244900c310974e1fc1c69066e450 ("[SCSI]
aic94xx: new driver"). So, given the current code, chances are that a
"CTRL-A user settings section" is always present and the code to create
a default section might as well be dropped. So perhaps a more drastic
patch is preferable.
drivers/scsi/aic94xx/aic94xx_sds.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c
index edb43fd..ecb4a1c 100644
--- a/drivers/scsi/aic94xx/aic94xx_sds.c
+++ b/drivers/scsi/aic94xx/aic94xx_sds.c
@@ -983,7 +983,7 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct *asd_ha,
{
int err, i;
u32 offs, size;
- struct asd_ll_el *el;
+ struct asd_ll_el *el = NULL;
struct asd_ctrla_phy_settings *ps;
struct asd_ctrla_phy_settings dflt_ps;
@@ -1004,6 +1004,7 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct *asd_ha,
size = sizeof(struct asd_ctrla_phy_settings);
ps = &dflt_ps;
+ goto ctrla_phy_settings;
}
if (size == 0)
@@ -1029,6 +1030,7 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct *asd_ha,
goto out2;
}
+ctrla_phy_settings:
err = asd_process_ctrla_phy_settings(asd_ha, ps);
if (err) {
ASD_DPRINTK("couldn't process ctrla phy settings\n");
--
1.7.11.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] aic94xx: fix handling of default CTRL-A settings
2012-09-25 12:07 [PATCH] aic94xx: fix handling of default CTRL-A settings Paul Bolle
@ 2012-10-29 10:42 ` Paul Bolle
0 siblings, 0 replies; 2+ messages in thread
From: Paul Bolle @ 2012-10-29 10:42 UTC (permalink / raw)
To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel
On Tue, 2012-09-25 at 14:07 +0200, Paul Bolle wrote:
> Compiling aic94xx_sds.o (part of the aic94xx driver) triggers this GCC
> warning:
> drivers/scsi/aic94xx/aic94xx_sds.c: In function 'asd_read_flash':
> drivers/scsi/aic94xx/aic94xx_sds.c:597:21: warning: 'offs' may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/scsi/aic94xx/aic94xx_sds.c:985:6: note: 'offs' was declared here
>
> This warning can be traced back to asd_find_flash_de(). If it fails to
> find a FLASH_DE_CTRL_A_USER entry it will return without setting 'offs'.
> And that will leave 'offs' uninitialized when asd_read_flash_seg() is
> called a little later.
>
> But that call of asd_read_flash_seg() isn't needed in that case.
> Everything this code cares about can already be found in the "default
> CTRL-A user settings section" that was created in the error path. So
> let's just jump over that call (and all other unneeded code) after
> creating that section.
>
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
> ---
> 0) I noticed this warning while building v3.6-rc7 on current Fedora
> 17, using Fedora's default config.
And, again, identical warnings can be seen while building v3.7-rc3.
What's the status of my patch? Did anyone found some time to have a look
at it?
Paul Bolle
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-29 10:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-25 12:07 [PATCH] aic94xx: fix handling of default CTRL-A settings Paul Bolle
2012-10-29 10:42 ` Paul Bolle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).