Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp72068imu; Wed, 21 Nov 2018 15:36:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/W16c0TCNkvV+aEaaDjqIWPBQu6w6ZZVU0KF8FgvYTTxvPD2KEvB7df1+szW4wFSDiyU/dJ X-Received: by 2002:a17:902:8214:: with SMTP id x20-v6mr8476499pln.224.1542843374594; Wed, 21 Nov 2018 15:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542843374; cv=none; d=google.com; s=arc-20160816; b=nYo/xzBAg3ToE154ZAt6ljlktkPLamOBDbYGgeJpd9p+kFicoa37axAokgOszqLOA/ UIhq9jixYDxbYk4ROnHProo8y1V6bVa/nhMPFfP6hz76FxKSbdcydTL2Ac1EdrQUFidI ljj23U7gEUdHgpYVBMhP8cNCwSzQ3bWkV5+1YfUa1YgRemCJmJ8rKgzeOOIjVFgf3QfL xTblK+/O8AIG/gl3JxdCdMqlBNwk1jbrgkU7Z4NIOlejKQ6NeGPNFNogi8MoLlA9IAMS DKjhlp54cpjPFCuP87/jF6RQrIXa8QyDrKTebQESVSDZKmMl8gO/aYCoTB/1AUihCAns sWjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hpziJ7t3sLZF0IgJc7m61G4rrsOfY5CRDCzjjWkdXYA=; b=H29blDY0Bp2SzuRZ6aPUvAAV7m2J5ZHqWAANuBsg7bjLdV43RkZ8Xq+NqlrtfCuBuJ bHKSoOaebrcjBbnMW2VO71Ih6bl5KnIUQRt1ywjfndlZTpaVxjBcOTr3qtyxXbVGb4/I sQ7Ghqaad8DEvyXF+uL2xEM+rW30mwYep+Dsf6KoYJJXkTyAo2LeyyOBqaekm/Xrd/Fr gqUN5RCjnkambU2xFLWPAlL1mk7xinR7Rm/KS9R78kpQWBp7X7dlUpr+CpgwoXwiO3SD MiGWVF/mWINUjZuYnUTgpU5zH5Zap5eYBitNdAcRo7EbdzNg+tPQeV0PN0kaYvE8jHho WxZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="P7YOd/zf"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s123-v6si52538876pfb.178.2018.11.21.15.35.57; Wed, 21 Nov 2018 15:36:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="P7YOd/zf"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387950AbeKVFnO (ORCPT + 99 others); Thu, 22 Nov 2018 00:43:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:37904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387767AbeKVFnN (ORCPT ); Thu, 22 Nov 2018 00:43:13 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 65E9F206BB; Wed, 21 Nov 2018 19:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542827260; bh=Kdpbl5Rh1Pk49G10YReYolI0wEv8f6A5fWz8WwUUtns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P7YOd/zf/2sw/OQNu7FrItCPlF9PDd2i5CqVzPrcQb08ZxPR6mzceallccwiiFad6 oRbMhmH7IVuZBdn7HyQM1TJKgaKGsce1TN6u1RNykNZU4/yZ97pswZNCqxN06TNGvC 0CcxQMnej2fIwKWD0SUv6GsnLfRG0Jz8UnnwO9TA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tristram Ha , Pavel Machek , Andrew Lunn , Florian Fainelli , "David S. Miller" Subject: [PATCH 4.19 34/42] net: dsa: microchip: initialize mutex before use Date: Wed, 21 Nov 2018 20:06:10 +0100 Message-Id: <20181121183149.443566626@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121183147.869199006@linuxfoundation.org> References: <20181121183147.869199006@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tristram Ha [ Upstream commit 284fb78ed7572117846f8e1d1d8e3dbfd16880c2 ] Initialize mutex before use. Avoid kernel complaint when CONFIG_DEBUG_LOCK_ALLOC is enabled. Fixes: b987e98e50ab90e5 ("dsa: add DSA switch driver for Microchip KSZ9477") Signed-off-by: Tristram Ha Reviewed-by: Pavel Machek Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/microchip/ksz_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1117,11 +1117,6 @@ static int ksz_switch_init(struct ksz_de { int i; - mutex_init(&dev->reg_mutex); - mutex_init(&dev->stats_mutex); - mutex_init(&dev->alu_mutex); - mutex_init(&dev->vlan_mutex); - dev->ds->ops = &ksz_switch_ops; for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) { @@ -1206,6 +1201,11 @@ int ksz_switch_register(struct ksz_devic if (dev->pdata) dev->chip_id = dev->pdata->chip_id; + mutex_init(&dev->reg_mutex); + mutex_init(&dev->stats_mutex); + mutex_init(&dev->alu_mutex); + mutex_init(&dev->vlan_mutex); + if (ksz_switch_detect(dev)) return -EINVAL;