Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1358278
| From | James Bottomley <jejb@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning |
| Date | 2016-03-15 22:50 +0100 |
| Message-ID | <rd50L-7UJ-29@gated-at.bofh.it> (permalink) |
| References | <rd50K-7UJ-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2016-03-15 at 22:40 +0100, Arnd Bergmann wrote: > The qlt_check_reserve_free_req() function produces an incorrect > warning when CONFIG_PROFILE_ANNOTATED_BRANCHES is set: > > drivers/scsi/qla2xxx/qla_target.c: In function > 'qlt_check_reserve_free_req': > drivers/scsi/qla2xxx/qla_target.c:1887:3: error: 'cnt_in' may be used > uninitialized in this function [-Werror=maybe-uninitialized] > ql_dbg(ql_dbg_io, vha, 0x305a, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "qla_target(%d): There is no room in the request ring: vha > ->req->ring_index=%d, vha->req->cnt=%d, req_cnt=%d Req-out=%d Req > -in=%d Req-Length=%d\n", > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~ > vha->vp_idx, vha->req->ring_index, > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > vha->req->cnt, req_cnt, cnt, cnt_in, vha->req->length); > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/scsi/qla2xxx/qla_target.c:1887:3: error: 'cnt' may be used > uninitialized in this function [-Werror=maybe-uninitialized] > > The problem is that gcc fails to track the state of the condition > across an annotated branch. > > This slightly rearranges the code to move the second if() block > into the first one, to avoid the warning while retaining the > behavior of the code. I thought our usual policy was to ask someone to fix the compiler when it emitted a spurious warning. James
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] qla2xxx: avoid maybe_uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-03-15 22:50 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning James Bottomley <jejb@linux.vnet.ibm.com> - 2016-03-15 22:50 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-03-16 14:10 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning Himanshu Madhani <himanshu.madhani@qlogic.com> - 2016-03-16 15:10 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning James Bottomley <jejb@linux.vnet.ibm.com> - 2016-03-16 15:30 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning Tomas Henzl <thenzl@redhat.com> - 2016-03-16 16:10 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning Tomas Henzl <thenzl@redhat.com> - 2016-03-16 16:20 +0100
Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning "Ewan D. Milne" <emilne@redhat.com> - 2016-03-16 16:50 +0100
csiph-web