svn commit: r308777 - head/sys/dev/iwm

Conrad Meyer cem at freebsd.org
Tue Nov 22 17:59:38 UTC 2016


Hi,

See inline below.

On Thu, Nov 17, 2016 at 12:00 PM, Imre Vadász <ivadasz at freebsd.org> wrote:
> 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 250a1c33fca1725121fe499f9cebc90267d209f9
>   Differential Revision:        https://reviews.freebsd.org/D8542
>
> Modified:
>   head/sys/dev/iwm/if_iwm.c
>
> Modified: head/sys/dev/iwm/if_iwm.c
> ==============================================================================
> --- 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 = {
>                 .id = IWM_NVM_ACCESS_CMD,
> -               .flags = IWM_CMD_SYNC | IWM_CMD_WANT_SKB |
> -                   IWM_CMD_SEND_IN_RFKILL,
> +               .flags = IWM_CMD_WANT_SKB | IWM_CMD_SEND_IN_RFKILL,
>                 .data = { &nvm_access_cmd, },
>         };
> -       int ret, offset_read;
> -       size_t bytes_read;
> +       int ret, bytes_read, offset_read;
>         uint8_t *resp_data;
>
>         cmd.len[0] = sizeof(struct iwm_nvm_access_cmd);
> @@ -1718,9 +1718,26 @@ iwm_nvm_read_chunk(struct iwm_softc *sc,
>         offset_read = le16toh(nvm_resp->offset);
>         resp_data = nvm_resp->data;
>         if (ret) {
> -               IWM_DPRINTF(sc, IWM_DEBUG_RESET,
> -                   "NVM access command failed with status %d\n", ret);
> -               ret = EINVAL;
> +               if ((offset != 0) &&
> +                   (ret == 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 != 0): driver already
> +                        * read valid data from another chunk so this case
> +                        * is not an error.
> +                        */
> +                       IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESET,
> +                                   "NVM access command failed on offset 0x%x since that section size is multiple 2K\n",
> +                                   offset);
> +                       *len = 0;
> +                       ret = 0;
> +               } else {
> +                       IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESET,
> +                                   "NVM access command failed with status %d\n", ret);
> +                       ret = EIO;
> +               }
>                 goto exit;
>         }


More information about the svn-src-all mailing list