Re: [PATCH 12/13] libnvdimm, pmem, pfn: move pfn setup to the core

Dan Williams
2016-03-24T15:26:48Z

On Thu, Mar 24, 2016 at 7:36 AM, Johannes Thumshirn <jthumshirn@suse.de> wrote:
> On Mittwoch, 23. März 2016 18:26:24 CET Dan Williams wrote:
>> Now that pmem internals have been disentangled from pfn setup, that code
>> can move to the core. This is in preparation for adding another user of
>> the pfn-device capabilities.
>>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
[..]
>> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
>> index f8fd379501bf..51a214ee75a7 100644
>> --- a/drivers/nvdimm/pfn_devs.c
>> +++ b/drivers/nvdimm/pfn_devs.c
[..]
>> +static int nd_pfn_init(struct nd_pfn *nd_pfn)
>> +{
>> + struct nd_namespace_common *ndns = nd_pfn->ndns;
>> + u32 start_pad = 0, end_trunc = 0;
>> + resource_size_t start, size;
>> + struct nd_namespace_io *nsio;
>> + struct nd_region *nd_region;
>> + struct nd_pfn_sb *pfn_sb;
>> + unsigned long npfns;
>> + phys_addr_t offset;
>> + u64 checksum;
>> + int rc;
>> +
>> + pfn_sb = devm_kzalloc(&nd_pfn->dev, sizeof(*pfn_sb), GFP_KERNEL);
>> + if (!pfn_sb)
>> + return -ENOMEM;
>> +
>> + nd_pfn->pfn_sb = pfn_sb;
>> + rc = nd_pfn_validate(nd_pfn);
>> + if (rc == -ENODEV)
>> + /* no info block, do init */;
>> + else
>> + return rc;
>
> Why not:
> if (rc != -ENODEV)
> return rc;
> /* no info block, do init */

Looks good to me, will fix.