Message ID | 20170501210241.GA11607@djiang5-desk3.ch.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 2017-05-01 at 14:02 -0700, Jiang, Dave wrote: > On Mon, May 01, 2017 at 01:25:45PM -0700, Kani, Toshimitsu wrote: > > On Thu, 2017-04-27 at 15:38 -0700, Dave Jiang wrote: : > > Toshi, > Can you please try this and see if that fixes the issue? Thanks! > > diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c > index 7399729..44fc2f3 100644 > --- a/ndctl/lib/libndctl.c > +++ b/ndctl/lib/libndctl.c > @@ -1882,10 +1882,8 @@ static int regions_badblocks_init(struct > ndctl_region *region) > region->badblocks = NULL; > } > > - if (asprintf(&bb_path, > "/sys/devices/platform/%s/%s/%s/badblocks", > - ndctl_bus_get_provider(bus), > - ndctl_bus_get_devname(bus), > - ndctl_region_get_devname(region)) < > 0) { > + if (asprintf(&bb_path, "%s/badblocks", > + region->region_path) < 0) { > rc = -errno; > err(ctx, "region badblocks path allocation > failure\n"); > return rc; Yes, this fixes the issue. :-) Noticed that there is a warning. CC libndctl.lo libndctl.c: In function 'regions_badblocks_init': libndctl.c:1875:20: warning: unused variable 'bus' [-Wunused-variable] struct ndctl_bus *bus = ndctl_region_get_bus(region); ^ Thanks!! -Toshi
On 05/01/2017 02:12 PM, Kani, Toshimitsu wrote: > On Mon, 2017-05-01 at 14:02 -0700, Jiang, Dave wrote: >> On Mon, May 01, 2017 at 01:25:45PM -0700, Kani, Toshimitsu wrote: >>> On Thu, 2017-04-27 at 15:38 -0700, Dave Jiang wrote: > : >> >> Toshi, >> Can you please try this and see if that fixes the issue? Thanks! >> >> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c >> index 7399729..44fc2f3 100644 >> --- a/ndctl/lib/libndctl.c >> +++ b/ndctl/lib/libndctl.c >> @@ -1882,10 +1882,8 @@ static int regions_badblocks_init(struct >> ndctl_region *region) >> region->badblocks = NULL; >> } >> >> -if (asprintf(&bb_path, >> "/sys/devices/platform/%s/%s/%s/badblocks", >> -ndctl_bus_get_provider(bus), >> -ndctl_bus_get_devname(bus), >> -ndctl_region_get_devname(region)) < >> 0) { >> +if (asprintf(&bb_path, "%s/badblocks", >> +region->region_path) < 0) { >> rc = -errno; >> err(ctx, "region badblocks path allocation >> failure\n"); >> return rc; > > Yes, this fixes the issue. :-) Noticed that there is a warning. > > CC libndctl.lo > libndctl.c: In function 'regions_badblocks_init': > libndctl.c:1875:20: warning: unused variable 'bus' [-Wunused-variable] > struct ndctl_bus *bus = ndctl_region_get_bus(region); Thanks! I'll spin v3 with the fixes.
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 7399729..44fc2f3 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -1882,10 +1882,8 @@ static int regions_badblocks_init(struct ndctl_region *region) region->badblocks = NULL; } - if (asprintf(&bb_path, "/sys/devices/platform/%s/%s/%s/badblocks", - ndctl_bus_get_provider(bus), - ndctl_bus_get_devname(bus), - ndctl_region_get_devname(region)) < 0) { + if (asprintf(&bb_path, "%s/badblocks", + region->region_path) < 0) { rc = -errno; err(ctx, "region badblocks path allocation failure\n"); return rc;