Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2702214pxf; Sun, 4 Apr 2021 11:00:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzln1+hWLTrLrru5fE7n5CcV0vwftM8c0IMB6S0QE1E27+0uzO2M6sjdd/SSBHMyW3/yvpZ X-Received: by 2002:a02:3712:: with SMTP id r18mr20655603jar.11.1617559212829; Sun, 04 Apr 2021 11:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617559212; cv=none; d=google.com; s=arc-20160816; b=b7r/flVLaH+gJ8ENHoB1hHGvYOsZU1WWTVXJ3tzDu4jtBdWM1M6NYOnUIuNsJSU7LE wcs3aUBWwIEqUFVr4Fe7snNoeDsgGgGyYbh6diR0o+uohLpa64WSEepmancxxycW2fno 4GUSOzHyl40b4Yplsz8z3jgFIIcbm3E3pgbVvbtaBYx7lL0uiRqq4E1iDjoDiGWvO1Cy 1YvO0cFxbHVL3UDqTbh49cVdirY1K1NUaey+rU4JY3PtbzP/G+N0q2Fxfosqk3nOM0s4 3deg2MIA1FGjWOOJXM7qMnp8m/es6hCvbNMz1sXdNakVQ1JRtu3ACXM1tzqgvgqE+IkU d/EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=jYiPx+pBBft0yEPoJ82ZYloFgLe1I4nB9Oi80zDpMoE=; b=sCNOMIXZGuNdgc8P4Wo5p5opIvj1qr/uCTsFdTcVdGrS2CoPDc/bnytUSsNxweYdkL 0WTHPDGTjJgL1O1YrR4jzvQo8vfilMCZN1sW4oHau57Gb3wGtkzJ38kUjz2rhL7X81ZJ u1lP6BtI+j56hSmmGSPy85RvXUGWXRMJcG8E93gtvcpn5aCPrMkOY/4jhar2p4bWjztL FYjnPOAZ7pxqTPeDv/BV9aoWz9yBO/xvW+Tz32w2DW36XoS3UhHasy2nltPqCDr0hPcf xkMw5G9D/xl+Ds1ZZRvSGbDzcofH6iHCG+yXgcgPiU3HF73MR2m4GBzv3LZQ4IFK3rdj 4+og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si11566172ilu.67.2021.04.04.10.59.58; Sun, 04 Apr 2021 11:00:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231312AbhDDR7j (ORCPT + 99 others); Sun, 4 Apr 2021 13:59:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:35756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbhDDR7g (ORCPT ); Sun, 4 Apr 2021 13:59:36 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 63C2361103; Sun, 4 Apr 2021 17:59:29 +0000 (UTC) Date: Sun, 4 Apr 2021 18:59:43 +0100 From: Jonathan Cameron To: Alexandru Ardelean Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Marek Szyprowski Subject: Re: [PATCH] iio: buffer: use sysfs_attr_init() on allocated attrs Message-ID: <20210404185943.63496d87@jic23-huawei> In-Reply-To: <20210402174226.630346-1-aardelean@deviqon.com> References: <20210402174226.630346-1-aardelean@deviqon.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2 Apr 2021 20:42:26 +0300 Alexandru Ardelean wrote: > When dynamically allocating sysfs attributes, it's a good idea to call > sysfs_attr_init() on them to initialize lock_class_keys. > This change does that. > > The lock_class_keys are set when the CONFIG_DEBUG_LOCK_ALLOC symbol is > enabled. Which is [likely] one reason why I did not see this during > development. > > I also am not able to see this even with CONFIG_DEBUG_LOCK_ALLOC enabled, > so this may [likely] be reproduce-able on some system configurations. > > This was reported via: > https://lore.kernel.org/linux-iio/CA+U=DsrsvGgXEF30-vXuXS_k=-mjSjiBwEEzwKb1hJVn1P98OA@mail.gmail.com/T/#u > > Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") > Reported-by: Marek Szyprowski > Signed-off-by: Alexandru Ardelean > --- > > @Marek: could you maybe test this on your setup? > > I haven't been able to reproduce this on mine. I'm fairly sure this is the right fix, and 'should' resolve the issue Marek saw so I'm going to queue it up. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it and see if we missed anything. Thanks, Jonathan > > Thanks > Alex > > drivers/iio/industrialio-buffer.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c > index ee5aab9d4a23..06b2ea087408 100644 > --- a/drivers/iio/industrialio-buffer.c > +++ b/drivers/iio/industrialio-buffer.c > @@ -1309,6 +1309,7 @@ static struct attribute *iio_buffer_wrap_attr(struct iio_buffer *buffer, > iio_attr->buffer = buffer; > memcpy(&iio_attr->dev_attr, dattr, sizeof(iio_attr->dev_attr)); > iio_attr->dev_attr.attr.name = kstrdup_const(attr->name, GFP_KERNEL); > + sysfs_attr_init(&iio_attr->dev_attr.attr); > > list_add(&iio_attr->l, &buffer->buffer_attr_list); >