Re: [PATCH 3/3] block: warn if ->groups is set when calling add_disk
From: Christoph Hellwig <hch@lst.de>
Date: 2021-09-21 06:32:14
Also in:
nvdimm
From: Christoph Hellwig <hch@lst.de>
Date: 2021-09-21 06:32:14
Also in:
nvdimm
On Mon, Sep 20, 2021 at 04:50:03PM -0700, Dan Williams wrote:
quoted
ddev->parent = parent; - ddev->groups = groups; + if (!WARN_ON_ONCE(ddev->groups)) + ddev->groups = groups;That feels too compact to me, and dev_WARN_ONCE() might save someone a git blame to look up the reason for the warning: dev_WARN_ONCE(parent, ddev->groups, "unexpected pre-populated attribute group\n"); if (!ddev->groups) ddev->groups = groups; ...but not a deal breaker. Either way you can add:
I'd rather keep it simple and optmize for the normal case..