Subject: Re: [PATCH v2 2/2] powerpc/nvdimm: use H_SCM_QUERY hcall on H_OVERLAP error

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Tue, 24 Sep 2019 16:29:14 +0530

Vaibhav Jain <[email-masked]> writes:

>> +err_out:
>> +	dev_info(&p->pdev->dev,
>> +		 "Failed to query, trying an unbind followed by bind");
>> +	drc_pmem_unbind(p);
>> +	return drc_pmem_bind(p);
>> +}
> Would have preferred error handling for bind failure to be done at
> single location i.e in papr_scm_probe() rather than in
> drc_pmem_query_n_bind().
>

IMHO the final code looks simpler.

	/* request the hypervisor to bind this region to somewhere in memory */
	rc = drc_pmem_bind(p);

	/* If phyp says drc memory still bound then force unbound and retry */
	if (rc == H_OVERLAP)
		rc = drc_pmem_query_n_bind(p);

	if (rc != H_SUCCESS) {
		dev_err(&p->pdev->dev, "bind err: %d\n", rc);
		rc = -ENXIO;
		goto err;
	}

-aneesh