Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6826932rwi; Mon, 24 Oct 2022 06:37:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76nMeeIMdiDCxz4c72lUkUnbWDObi7B+um+0MKnWVO5xZTpIShljSeyqJZEFlhI+scIOPr X-Received: by 2002:a17:907:d25:b0:7aa:3503:8c86 with SMTP id gn37-20020a1709070d2500b007aa35038c86mr2120443ejc.759.1666618657635; Mon, 24 Oct 2022 06:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618657; cv=none; d=google.com; s=arc-20160816; b=eF8Mc3MGV6wHOSA7AxoVi/H7k1M9BMOSofLyB9jxJM/4pr09FFzE7vOVb8PP2GxmH0 d6/BGd5xOhZ42Mcr109hh+COjfpDdt/eJ9ZLV8FG/OGEBhEQuW0Jmp+MswyTobsuwL7b Uj/4yndyZCfhrgnnUZEedClxxRsIR70vBYnZ1NwdFOpmw7RVtv7N1Vxw3DHkT82tCGf/ Tz8c1D3aXW+9AMyQWUaOiGPCjlNBkWopt5tta887mZc6sNE6U4AF9GXx2amlPDX5ItNP pvzH3HPbNRDgiomcrNwF99f1y60b73mWI07HXSj6gNy1Fl26iwREgDQH1yDM/jqJ8ush ZMqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bbQqD09h0kMDWH3J0zUV/OlX+1yLdEhK5ckTWLr8oks=; b=Ah1ssCRrQZrjOgsjfCjDVrue8IC1IeindtxHB5RONEoApaJAuJbU7gJYHlBUqoEo3g kcZBz3GCGTeotq7EWiF/wFqZXKa5X5J8N6GEUA10Ivi7tsOBKVK47dwTfOdA9bKmp7vv wVgxHXBfPDHi1UUP6A/jmVhtc248rcQg9QG1ToKzRwjIfQYz6MoY6z41q9xhsyr9S4HH sqQGiNRR3ZsWGjGo3LB33nhWYAPjvvmzvJNaK//C+03cK+vt2Ikvv7YkQZJSJ2npa3dE MP4tWT+CPuQ081V62x5XWq6UQbBw9EVrSu7ZNnBkqEHiakHyZaHDerT9qYlp46jxxis/ utVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OxWhS+te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a1709065d1100b007316ac034acsi26691414ejt.834.2022.10.24.06.37.03; Mon, 24 Oct 2022 06:37:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OxWhS+te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235935AbiJXNV6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236471AbiJXNUd (ORCPT ); Mon, 24 Oct 2022 09:20:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B2F87681; Mon, 24 Oct 2022 05:29:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6964612C4; Mon, 24 Oct 2022 12:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1A8C433D7; Mon, 24 Oct 2022 12:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613077; bh=QU5vmXNJ3Gr1SJU1WZy8eaBaS35TPYAliopPzIIp1pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OxWhS+teHRx/gFvEFDfccYRp9yl7x2hiN87EhtYxn9hAZcN7YNs0hZMzdeNzAwmdn HR1yFsbSvkjo2RtF3ODaWVhKoP9VZamhqVPOg8jddNKUzUuxxSSmeZj6eS7mKyua6O C0AvBDCg+aej92p+76AGn7kgsyyhEVG2GuNLWpiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Lien , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 218/229] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:17 +0200 Message-Id: <20221024113006.299576645@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keith Busch [ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ] The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data. Reported-by: Jeff Lien Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 582c3b190418..986912e680d8 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2320,7 +2320,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) nvme_init_subnqn(subsys, ctrl, id); memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); memcpy(subsys->model, id->mn, sizeof(subsys->model)); - memcpy(subsys->firmware_rev, id->fr, sizeof(subsys->firmware_rev)); subsys->vendor_id = le16_to_cpu(id->vid); subsys->cmic = id->cmic; @@ -2481,6 +2480,8 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); -- 2.35.1