On 03/07/2017 02:30 AM, Johannes Thumshirn wrote: > On 03/06/2017 09:32 PM, Dave Jiang wrote: >> Providing mechanism to clear poison list via the ndctl ND_CMD_CLEAR_ERROR >> call. We will update the poison list and also the badblocks at region level >> if the region is in dax mode or in pmem mode and not active. >> >> Signed-off-by: Dave Jiang <dave.ji...@intel.com> >> --- > > [...] > >> + if ((cmd != ND_CMD_CLEAR_ERROR) || !nvdimm_bus || !clear_err->cleared) > ^~ Unnecessary parenthesis? > > [...] > >> + >> + /* make sure clear_err range is within a SPA range */ >> + if (((clear_begin >= spa_begin) && >> + (clear_begin < (spa_end))) && >> + ((clear_end > spa_begin) && >> + (clear_end <= spa_end))) { > > Indentation looks a bit odd here and the superfluous parenthesis aren't > improving the situation. > > [...]
I'll fix that. > > >> + if (nd_btt || nd_pfn || nd_dax) { >> + if (nd_btt) >> + ndns = nd_btt->ndns; >> + else if (nd_pfn) >> + ndns = nd_pfn->ndns; >> + else if (nd_dax) >> + ndns = nd_dax->nd_pfn.ndns; >> + >> + if (!ndns) >> + return 0; > > How can this (the !ndns case) ever happen? So if nd_btt->ndns or nd_pfn->ndns or nd_dax->nd_pfn.ndns happens to be NULL, then this case can happen. I don't know how likely that is to happen however. The code was lifted from nvdimm_namespace_common_probe(). > > And anyways isn't this sufficient, or am I missing something: > > if (nd_btt) > ndns = nd_btt->ndns; > else if (nd_pfn) > ndns = nd_pfn->ndns; > else if (nd_dax) > ndns = nd_dax->nd_pfn.ndns; > else > ndns = to_ndns(dev); > >> + } else >> + ndns = to_ndns(dev); >> + > > Thanks, > Johannes > _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm