* [PATCH] drivers/ssb/driver_chipcommon_pmu.c: uninitilized warning
@ 2011-06-11 18:14 Connor Hansen
2011-06-11 18:50 ` Michael Büsch
0 siblings, 1 reply; 3+ messages in thread
From: Connor Hansen @ 2011-06-11 18:14 UTC (permalink / raw)
To: mb; +Cc: netdev, linux-kernel, Connor Hansen
warning message
drivers/ssb/driver_chipcommon_pmu.c: In function ssb_pmu_resources_init
drivers/ssb/driver_chipcommon_pmu.c:420:15: warning: updown_tab_size may
be used uninitilized in this function.
updown_tab_size and depend_tab_size may not be set in the bus->chip_id
switch statement, so set to 0 by default to avoid using uninitialized
stack space.
Signed-off-by: Connor Hansen <cmdkhh@gmail.com>
---
drivers/ssb/driver_chipcommon_pmu.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
index 305ade7..a7aef47 100644
--- a/drivers/ssb/driver_chipcommon_pmu.c
+++ b/drivers/ssb/driver_chipcommon_pmu.c
@@ -417,9 +417,9 @@ static void ssb_pmu_resources_init(struct ssb_chipcommon *cc)
u32 min_msk = 0, max_msk = 0;
unsigned int i;
const struct pmu_res_updown_tab_entry *updown_tab = NULL;
- unsigned int updown_tab_size;
+ unsigned int updown_tab_size = 0;
const struct pmu_res_depend_tab_entry *depend_tab = NULL;
- unsigned int depend_tab_size;
+ unsigned int depend_tab_size = 0;
switch (bus->chip_id) {
case 0x4312:
--
1.7.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/ssb/driver_chipcommon_pmu.c: uninitilized warning
2011-06-11 18:14 [PATCH] drivers/ssb/driver_chipcommon_pmu.c: uninitilized warning Connor Hansen
@ 2011-06-11 18:50 ` Michael Büsch
2011-06-12 9:07 ` Borislav Petkov
0 siblings, 1 reply; 3+ messages in thread
From: Michael Büsch @ 2011-06-11 18:50 UTC (permalink / raw)
To: Connor Hansen; +Cc: mb, netdev, linux-kernel
On Sat, 11 Jun 2011 11:14:45 -0700
Connor Hansen <cmdkhh@gmail.com> wrote:
> warning message
> drivers/ssb/driver_chipcommon_pmu.c: In function ssb_pmu_resources_init
> drivers/ssb/driver_chipcommon_pmu.c:420:15: warning: updown_tab_size may
> be used uninitilized in this function.
>
> updown_tab_size and depend_tab_size may not be set in the bus->chip_id
> switch statement, so set to 0 by default to avoid using uninitialized
> stack space.
We wouldn't be using uninitialized stack space or uninitialized variables,
without this patch. However, for the sake of shutting up the compiler, ACK.
> Signed-off-by: Connor Hansen <cmdkhh@gmail.com>
> ---
> drivers/ssb/driver_chipcommon_pmu.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
> index 305ade7..a7aef47 100644
> --- a/drivers/ssb/driver_chipcommon_pmu.c
> +++ b/drivers/ssb/driver_chipcommon_pmu.c
> @@ -417,9 +417,9 @@ static void ssb_pmu_resources_init(struct ssb_chipcommon *cc)
> u32 min_msk = 0, max_msk = 0;
> unsigned int i;
> const struct pmu_res_updown_tab_entry *updown_tab = NULL;
> - unsigned int updown_tab_size;
> + unsigned int updown_tab_size = 0;
> const struct pmu_res_depend_tab_entry *depend_tab = NULL;
> - unsigned int depend_tab_size;
> + unsigned int depend_tab_size = 0;
>
> switch (bus->chip_id) {
> case 0x4312:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/ssb/driver_chipcommon_pmu.c: uninitilized warning
2011-06-11 18:50 ` Michael Büsch
@ 2011-06-12 9:07 ` Borislav Petkov
0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2011-06-12 9:07 UTC (permalink / raw)
To: Connor Hansen; +Cc: Michael Büsch, mb, netdev, linux-kernel
On Sat, Jun 11, 2011 at 08:50:57PM +0200, Michael Büsch wrote:
> On Sat, 11 Jun 2011 11:14:45 -0700
> Connor Hansen <cmdkhh@gmail.com> wrote:
>
> > warning message
> > drivers/ssb/driver_chipcommon_pmu.c: In function ssb_pmu_resources_init
> > drivers/ssb/driver_chipcommon_pmu.c:420:15: warning: updown_tab_size may
> > be used uninitilized in this function.
> >
> > updown_tab_size and depend_tab_size may not be set in the bus->chip_id
> > switch statement, so set to 0 by default to avoid using uninitialized
> > stack space.
>
> We wouldn't be using uninitialized stack space or uninitialized variables,
> without this patch. However, for the sake of shutting up the compiler, ACK.
Also, Connor you have to be more specific in your commit messages.
Especially if this warning is triggered only with the extended build
checks aka make W=[123].
Please take a look at the code and check whether this is actually
fixing anything first because Michael is correct - there's no case
where {depend,uptown}_tab_size will be used uninitialized. So having
unnecessary churn when the compiler bitches about something it can't
understand yet is not something we want.
Thanks.
>
> > Signed-off-by: Connor Hansen <cmdkhh@gmail.com>
> > ---
> > drivers/ssb/driver_chipcommon_pmu.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
> > index 305ade7..a7aef47 100644
> > --- a/drivers/ssb/driver_chipcommon_pmu.c
> > +++ b/drivers/ssb/driver_chipcommon_pmu.c
> > @@ -417,9 +417,9 @@ static void ssb_pmu_resources_init(struct ssb_chipcommon *cc)
> > u32 min_msk = 0, max_msk = 0;
> > unsigned int i;
> > const struct pmu_res_updown_tab_entry *updown_tab = NULL;
> > - unsigned int updown_tab_size;
> > + unsigned int updown_tab_size = 0;
> > const struct pmu_res_depend_tab_entry *depend_tab = NULL;
> > - unsigned int depend_tab_size;
> > + unsigned int depend_tab_size = 0;
> >
> > switch (bus->chip_id) {
> > case 0x4312:
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Regards/Gruss,
Boris.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-12 9:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-11 18:14 [PATCH] drivers/ssb/driver_chipcommon_pmu.c: uninitilized warning Connor Hansen
2011-06-11 18:50 ` Michael Büsch
2011-06-12 9:07 ` Borislav Petkov
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).