From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbdFEFi3 (ORCPT ); Mon, 5 Jun 2017 01:38:29 -0400 Received: from verein.lst.de ([213.95.11.211]:38026 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbdFEFi2 (ORCPT ); Mon, 5 Jun 2017 01:38:28 -0400 Date: Mon, 5 Jun 2017 07:38:27 +0200 From: Christoph Hellwig To: Johannes Thumshirn Cc: Christoph Hellwig , Sagi Grimberg , Keith Busch , Hannes Reinecke , maxg@mellanox.com, Linux NVMe Mailinglist , Linux Kernel Mailinglist Subject: Re: [PATCH v4 5/8] nvme: get list of namespace descriptors Message-ID: <20170605053825.GE19480@lst.de> References: <20170604103649.22130-1-jthumshirn@suse.de> <20170604103649.22130-6-jthumshirn@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170604103649.22130-6-jthumshirn@suse.de> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + } > + len = NVME_NIDT_UUID_LEN; > + memcpy(ns->uuid, data + pos + sizeof(*cur), len); > + break; > + default: > + dev_warn(ns->ctrl->dev, > + "Invalid Namespace Identification Descriptor Type: %d\n", > + cur->nidt); > + return; Please drop the warning and return, the spec says hosts should ignore unknown types. This is important to future proof for new types that could be added. > +static int nvme_identify_ns_descs(struct nvme_ns *ns, unsigned nsid) > +{ > + struct nvme_command c = { }; > + int status; > + void *data; > + > + c.identify.opcode = nvme_admin_identify; > + c.identify.nsid = cpu_to_le32(nsid); > + c.identify.cns = NVME_ID_CNS_NS_DESC_LIST; > + > + data = kzalloc(NVME_IDENTIFY_DATA_SIZE, GFP_KERNEL); > + if (!data) > + return -ENOMEM; > + > + status = nvme_submit_sync_cmd(ns->ctrl->admin_q, &c, data, > + NVME_IDENTIFY_DATA_SIZE); > + if (status) > + goto free_data; > + > + nvme_parse_ns_descs(ns, data); Just merge nvme_parse_ns_descs into the caller?