Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9122398pxu; Mon, 28 Dec 2020 07:10:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmHA1OzfP+ySswbhqARrKoZgs94h8XD27RdabhvvfKI7qgBQ/eqYPfYmBc0LZXIY8wB4dL X-Received: by 2002:aa7:c64e:: with SMTP id z14mr38082059edr.69.1609168241924; Mon, 28 Dec 2020 07:10:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168241; cv=none; d=google.com; s=arc-20160816; b=uSZcbrDYUxDrvkcbryOzy1/U8DPkEnsUOWkEO6nSoqMPsdswm/qZzUVlWppGxOyfNs 1zhz8Xtqgly+82QbNvD1yXcapT8KCtuXJy5m16zNoSv2e3LALt4bq+fV8Sx5NpKrn/UD vXCEMZMWzrABYa+YJwEpdEvGlgKlTyhCkBeN3vjWpYyimu6Ry9+p0+uTHskJEHX52Phb 8PgxekB58GlMeZxzUpXRaSbNXM4/k32dZfV+FpFGa0mLOk+LO1JGKKlPKgGoSY7p8UAI cUasPMsdNWquGEGDyT+/CnoH9/tI+OIjnWVeH0Fma4aZzsLB3/ufP9zClV6TaHb0Gn+w 5rTQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gv4mabmgGup/d77FkqocGTIfF0nT4LcZCP9cqr3bofI=; b=rSDhf+TDAJoXE1pk03BO3Drm6XUw4gO2LpebiWPcnoKbWLylXWoQh+i8R0+dQmKhr7 w7DrbNUgxggQ9BXRdBbWxw9GY+RwN/IFfJnXyCQVpDAm/scJbfcYxcQddlp6djPUt0dV wbzXtI9hnmqPD+7/N48Kp1QcY28bNYo8rfXkv12Crr4DFDjstbY9Ry0ORsllY/SebsvN w3Np7GoEUM66UaAB3DsIGO7HCKSfQMrEbDjQaCgIIKK4ErAC1aP9E8DoBkuaGHo6ohf0 TPOm2yyiK+0CMdcFJP9HV/ub3/fOPi1q8QqePNi1WAjooWJgiGcfYQBKSmxJCKvBk8D5 Yhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XFe0/uyT"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si18802115ejc.686.2020.12.28.07.10.18; Mon, 28 Dec 2020 07:10:41 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XFe0/uyT"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2440046AbgL1PHl (ORCPT + 99 others); Mon, 28 Dec 2020 10:07:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:42916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438648AbgL1OIW (ORCPT ); Mon, 28 Dec 2020 09:08:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BBB1207B2; Mon, 28 Dec 2020 14:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164461; bh=acT3mKttGcyO3UWU/y7jp1NdbrD1iqSk6HLFTMBJsqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XFe0/uyTnDSJtdLuSM8PQzcVzBoKsfS6lmTmwgMiyncjZmqBXm7dfsu0ybIEbJNgD hEfd3JH9H39/VOTL7gba2BRVvp/NeW6LcoBEjarBzIN/mrq83ncri/SCja760/U0eV Ry7BR9hoo3KhyA9FOExlZclDTqjE+Soz9JoHXCBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Pierre-Louis Bossart , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 189/717] soundwire: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Date: Mon, 28 Dec 2020 13:43:07 +0100 Message-Id: <20201228125030.026635784@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla [ Upstream commit e6db818a3f51781ba12ac4d52b8773f74d57b06b ] running kernel with CONFIG_DEBUG_LOCKS_ALLOC enabled will below warning: BUG: key ffff502e09807098 has not been registered! DEBUG_LOCKS_WARN_ON(1) WARNING: CPU: 5 PID: 129 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0xe8/0x250 Modules linked in: CPU: 5 PID: 129 Comm: kworker/5:1 Tainted: G W 5.10.0-rc1-00277-ged49f224ca3f-dirty #1210 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) Workqueue: events deferred_probe_work_func pstate: 80c00005 (Nzcv daif +PAN +UAO -TCO BTYPE=--) pc : lockdep_init_map_waits+0xe8/0x250 lr : lockdep_init_map_waits+0xe8/0x250 [ Trimmed ] Call trace: lockdep_init_map_waits+0xe8/0x250 __kernfs_create_file+0x78/0x180 sysfs_add_file_mode_ns+0x94/0x1c8 internal_create_group+0x110/0x3e0 sysfs_create_group+0x18/0x28 devm_device_add_group+0x4c/0xb0 add_all_attributes+0x438/0x490 sdw_slave_sysfs_dpn_init+0x128/0x138 sdw_slave_sysfs_init+0x80/0xa0 sdw_drv_probe+0x94/0x170 really_probe+0x118/0x3e0 driver_probe_device+0x5c/0xc0 [ Trimmed ] CPU: 5 PID: 129 Comm: kworker/5:1 Tainted: G W 5.10.0-rc1-00277-ged49f224ca3f-dirty #1210 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) Workqueue: events deferred_probe_work_func Call trace: dump_backtrace+0x0/0x1c0 show_stack+0x18/0x68 dump_stack+0xd8/0x134 __warn+0xa0/0x158 report_bug+0xc8/0x178 bug_handler+0x20/0x78 brk_handler+0x70/0xc8 [ Trimmed ] Fix this by initializing dynamically allocated sysfs attribute to keep lockdep happy! Fixes: bcac59029955 ("soundwire: add Slave sysfs support") Signed-off-by: Srinivas Kandagatla Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20201104112941.1134-1-srinivas.kandagatla@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/sysfs_slave_dpn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soundwire/sysfs_slave_dpn.c b/drivers/soundwire/sysfs_slave_dpn.c index 05a721ea9830a..c4b6543c09fd6 100644 --- a/drivers/soundwire/sysfs_slave_dpn.c +++ b/drivers/soundwire/sysfs_slave_dpn.c @@ -37,6 +37,7 @@ static int field##_attribute_alloc(struct device *dev, \ return -ENOMEM; \ dpn_attr->N = N; \ dpn_attr->dir = dir; \ + sysfs_attr_init(&dpn_attr->dev_attr.attr); \ dpn_attr->format_string = format_string; \ dpn_attr->dev_attr.attr.name = __stringify(field); \ dpn_attr->dev_attr.attr.mode = 0444; \ -- 2.27.0