Date: Tue, 22 Nov 2016 09:59:29 -0800 From: Conrad Meyer <cem@freebsd.org> To: =?UTF-8?B?SW1yZSBWYWTDoXN6?= <ivadasz@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308777 - head/sys/dev/iwm Message-ID: <CAG6CVpX0oySPyJUDUKsMzvKw5vBXUTt3JwWpvXSH4-rNq7mu0w@mail.gmail.com> In-Reply-To: <201611172000.uAHK0KPS084672@repo.freebsd.org> References: <201611172000.uAHK0KPS084672@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, See inline below. On Thu, Nov 17, 2016 at 12:00 PM, Imre Vad=C3=A1sz <ivadasz@freebsd.org> wr= ote: > Author: ivadasz > Date: Thu Nov 17 20:00:20 2016 > New Revision: 308777 > URL: https://svnweb.freebsd.org/changeset/base/308777 > > Log: > [iwm] Sync iwm_nvm_read_chunk() function with Linux iwlwifi. > > This fixes an error handling detail in iwm_nvm_read_chunk(), where an > error response from the firmware for an NVM read shouldn't be fatal if > the offset was non-zero. > > Approved by: adrian (mentor) > Obtained from: DragonFlyBSD git 250a1c33fca1725121fe499f9cebc902= 67d209f9 > Differential Revision: https://reviews.freebsd.org/D8542 > > Modified: > head/sys/dev/iwm/if_iwm.c > > Modified: head/sys/dev/iwm/if_iwm.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/iwm/if_iwm.c Thu Nov 17 19:38:30 2016 (r308776) > +++ head/sys/dev/iwm/if_iwm.c Thu Nov 17 20:00:20 2016 (r308777) > ... > @@ -1684,12 +1686,10 @@ iwm_nvm_read_chunk(struct iwm_softc *sc, > struct iwm_rx_packet *pkt; > struct iwm_host_cmd cmd =3D { > .id =3D IWM_NVM_ACCESS_CMD, > - .flags =3D IWM_CMD_SYNC | IWM_CMD_WANT_SKB | > - IWM_CMD_SEND_IN_RFKILL, > + .flags =3D IWM_CMD_WANT_SKB | IWM_CMD_SEND_IN_RFKILL, > .data =3D { &nvm_access_cmd, }, > }; > - int ret, offset_read; > - size_t bytes_read; > + int ret, bytes_read, offset_read; > uint8_t *resp_data; > > cmd.len[0] =3D sizeof(struct iwm_nvm_access_cmd); > @@ -1718,9 +1718,26 @@ iwm_nvm_read_chunk(struct iwm_softc *sc, > offset_read =3D le16toh(nvm_resp->offset); > resp_data =3D nvm_resp->data; > if (ret) { > - IWM_DPRINTF(sc, IWM_DEBUG_RESET, > - "NVM access command failed with status %d\n", ret); > - ret =3D EINVAL; > + if ((offset !=3D 0) && > + (ret =3D=3D IWM_READ_NVM_CHUNK_NOT_VALID_ADDRESS)) { Coverity reports that this is deadcode, because 'offset' is always zero at this point. Perhaps this should be 'offset_read' or 'nvm_access_cmd.offset'? CID 1366220. Best, Conrad > + /* > + * meaning of NOT_VALID_ADDRESS: > + * driver try to read chunk from address that is > + * multiple of 2K and got an error since addr is = empty. > + * meaning of (offset !=3D 0): driver already > + * read valid data from another chunk so this cas= e > + * is not an error. > + */ > + IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESE= T, > + "NVM access command failed on offset = 0x%x since that section size is multiple 2K\n", > + offset); > + *len =3D 0; > + ret =3D 0; > + } else { > + IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESE= T, > + "NVM access command failed with statu= s %d\n", ret); > + ret =3D EIO; > + } > goto exit; > }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpX0oySPyJUDUKsMzvKw5vBXUTt3JwWpvXSH4-rNq7mu0w>