Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2085213iof; Tue, 7 Jun 2022 19:13:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX6crG0vU7/7rldlNE1z/TMky8wEWo2YlW+4iUfD22WQGIvyWRR5k6+Jp+n/lN6fw7GMhl X-Received: by 2002:a63:69c5:0:b0:3fb:a606:819a with SMTP id e188-20020a6369c5000000b003fba606819amr28040936pgc.81.1654654406729; Tue, 07 Jun 2022 19:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654654406; cv=none; d=google.com; s=arc-20160816; b=Uxuo42gMNrHjKeinG116g1e/z4ne7ruviYdCCpbIx9E4VWafPmlNZPXd1+jIAnlnFE ys1fj4c+CYR2JwcsYrbzyDNMz1nEObhOHRqbslyr1F1wTwD8/v/C4XSH9i6nNlCObOi6 AsWzSfFkwzwbmSFykURFiygcXkED/ZrFtJBNnk/6w+CgkL3Wc0eFh0fUQ32e5ykaEsDY iwIqNNOzFfFVG+XiWGSVj+Yu/tfMXt+YPfbATieC9Y6lLXspUzQXA5NzB51WxITqjzSA eQlgyDNWbIXIODJdqRol9gIbaXIR88SzS6wCVRkuZH660i6J9cZbIrVFaw6m8IXslHNV j/xA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0Xn+Bd9iLd12/ydYV/MdOGZtJF6xW1053mZnbt9JnUk=; b=u6VogYgmgKbrZP5oaCDaakJI4InsFMjeGIudmfnrLuDQGzOQ0Z/SBGMeqYYKxArKDd SMewWYpjsPdRcFdbaJehFskbQKxTBPkffAvR6yP5XB1etyz4pJx+fargfSh2DyeUMacD NXsY2bz7YjBQsECh9HpTyjEPKgTlDbQWDX6tjCpKMoHYkNEjFrLjrfJ1/TzS4Caqh27Y 6sBTjcXuq0q9qEknXzyQRDB7HMwaf9TYqRpxWY8kOj3eLwJ5EghyzaS5Vdjd1z9FUfnb R6s51v5gzKAty1f3TXZLr0/k20ggWK87f+yn/dsibpoP0TUlDcDW0RCc9drSQWjIK/Qf wKOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lHAKYIm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e4-20020a170902ef4400b0015ceea6bd9esi26307091plx.550.2022.06.07.19.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lHAKYIm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8115C3511EC; Tue, 7 Jun 2022 18:48:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344102AbiFGPby (ORCPT + 99 others); Tue, 7 Jun 2022 11:31:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232029AbiFGPbv (ORCPT ); Tue, 7 Jun 2022 11:31:51 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A136F5067 for ; Tue, 7 Jun 2022 08:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654615910; x=1686151910; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=x+VtFWdXpux7/W9Qk2tMxPNhs7vkk3dWzPjYVSKAWwY=; b=lHAKYIm6ErL44ZM9gh8IWxkhHrKUpmyvQZ+VwHJBnAs9scHUSVuLBh6K MdYpANmIgyj1Kr7/kaJJd6sk9DR5JGec1bEtd5A1cLx0altU6SlSa0GZO ajgXHdPy7DYkt5YcVQ4XEnERWgwwMsPHUegODalvvZTGviZ3e5K7a4tbr HREYBUjqEBuPWk9fzi0qSllDyAhrV4a8DhkmUdNOb1OHwno6opogctDNO xE3M2nWmCv0/yHrAWU1pu3FOS/2QUAiayvddFjVYu6u1+bLBjXWgGDQCB 0dWcdkqbIhSM1F6v3T39Mw+etCIKYMfwXjZf+4Dc0XiRW6BGwoSxYX5iu A==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="259570052" X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="259570052" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 08:25:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="584242600" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 07 Jun 2022 08:25:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 50040109; Tue, 7 Jun 2022 18:25:30 +0300 (EEST) From: Andy Shevchenko To: Dan Williams , nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Vishal Verma , Dave Jiang , Ira Weiny , Andy Shevchenko Subject: [PATCH v1 1/1] nvdimm/namespace: return uuid_null only once in nd_dev_to_uuid() Date: Tue, 7 Jun 2022 18:25:25 +0300 Message-Id: <20220607152525.33468-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Refactor nd_dev_to_uuid() in order to make code shorter and cleaner by joining conditions and hence returning uuid_null only once. Signed-off-by: Andy Shevchenko --- drivers/nvdimm/namespace_devs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index bf4f5c09d9b1..3dae17c90e8c 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c @@ -170,15 +170,12 @@ EXPORT_SYMBOL(nvdimm_namespace_disk_name); const uuid_t *nd_dev_to_uuid(struct device *dev) { - if (!dev) - return &uuid_null; - - if (is_namespace_pmem(dev)) { + if (dev && is_namespace_pmem(dev)) { struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); return nspm->uuid; - } else - return &uuid_null; + } + return &uuid_null; } EXPORT_SYMBOL(nd_dev_to_uuid); -- 2.35.1