From owner-svn-src-head@freebsd.org Tue Nov 22 17:59:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80E7CC5085C; Tue, 22 Nov 2016 17:59:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 542961244; Tue, 22 Nov 2016 17:59:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f65.google.com with SMTP id n68so2723818itn.3; Tue, 22 Nov 2016 09:59:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=KGGNzII8sa/GnCIR6f/ypLwDBsjNcTDF+KsYANCQlrs=; b=R5Ymj5+c4labMXCHXNjY/Zy7aKqND7AEZG0sar24Oms/bNtNFtX/U0JHvkYOYOdH/i P5Bu4ZIjIiqV+7jlzZLVf5A7lFmo+wVQ3m/lOIyGi7Wkz10+Y6Kp1SlEVgneRQpU/2EW WTZiaVBX8/ohYS+9lFcyhaxg+ikLq36HqADX2s2bpKzZlZcELp+bnGGblVa21W6kiBRd JTlHh5TGdw1nT/5Dmj9zm8EPYuXC3N59QFHLBvUooJw6aON34zOTZV9H0IFhJyKLEDfF 0jpiXzm0cFerteIXzaz4vk3ThF6UKJ5B81EIpffkwR+4VNmvTF+8vWWksPBX43Nw92ef wVFg== X-Gm-Message-State: AKaTC00rjJSp+jYmiiTJxzDIhYN4d8+E2uM77WPLAY/BDhIWgKJ+qC8IImKw0xYPJALFEQ== X-Received: by 10.36.61.146 with SMTP id n140mr3650328itn.78.1479837570558; Tue, 22 Nov 2016 09:59:30 -0800 (PST) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id m127sm1117414itc.19.2016.11.22.09.59.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 09:59:30 -0800 (PST) Received: by mail-it0-f52.google.com with SMTP id j191so18349998ita.1; Tue, 22 Nov 2016 09:59:30 -0800 (PST) X-Received: by 10.36.99.68 with SMTP id j65mr3455841itc.119.1479837569931; Tue, 22 Nov 2016 09:59:29 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.109.68 with HTTP; Tue, 22 Nov 2016 09:59:29 -0800 (PST) In-Reply-To: <201611172000.uAHK0KPS084672@repo.freebsd.org> References: <201611172000.uAHK0KPS084672@repo.freebsd.org> From: Conrad Meyer Date: Tue, 22 Nov 2016 09:59:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r308777 - head/sys/dev/iwm To: =?UTF-8?B?SW1yZSBWYWTDoXN6?= Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 17:59:38 -0000 Hi, See inline below. On Thu, Nov 17, 2016 at 12:00 PM, Imre Vad=C3=A1sz 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; > }