lkml.org 
[lkml]   [2018]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 13/13] libnvdimm, namespace: Publish page structure init state / control
On Wed, Jul 04, 2018 at 11:50:13PM -0700, Dan Williams wrote:
> +static ssize_t memmap_state_store(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t len)
> +{
> + int i;
> + struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
> + struct memmap_async_state *async = &nd_pfn->async;
> +
> + if (strcmp(buf, "sync") == 0)
> + /* pass */;
> + else if (strcmp(buf, "sync\n") == 0)
> + /* pass */;
> + else
> + return -EINVAL;

Hmm what about:

if (strncmp(buf, "sync", 4))
return -EINVAL;

This collapses 6 lines into 4.


--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

\
 
 \ /
  Last update: 2018-07-05 10:31    [W:0.315 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site