From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB9F341C79; Sun, 6 Oct 2024 02:28:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181730; cv=none; b=ofrIFKn2fddBhTsLNHbV5GIJ7FnJWLRWYeSo07V+fH7KtfR47CYjVclKFfjLdi/0/Yg6NyPZhBYycxaDX8VxNy2cts4kpNJ5V52Gs9hz6QiFTQ7KoBvxTEfAgWZHG2TkIx6kjp6rxWfrFrdn4Hkn6Om2gOGLPJVKSKCHg88AEwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181730; c=relaxed/simple; bh=R3/zEAcwhIv1vvXu5eqLy8v9T/QO1blsvg8rxiWDF6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hzUI9aDGlTo5uTb+87SIPKGKzMu+huga2a5d/tZd1VBh+7hZCYWe9Tt58Cs+vZAswi0oY7BAVR59JSx/DuxZPKGNSkJgrsJyWyneIj1ZBFgJrZ0dZ/i8KFeT+PZNP7vdTKS6xAKqrBDrz1Yx76VsNaYTXubDMj0hcxaJgdYh+O8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CqcYtR1H; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CqcYtR1H" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71df468496fso820431b3a.1; Sat, 05 Oct 2024 19:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181728; x=1728786528; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DoSnKsCafEyqo0X8z8XwraZSkcHXlpNQF2EXgefwFyU=; b=CqcYtR1HnQK1mCuGKe1eSl5CbwOlOrs0WTuTM2joHB/JYIP0OoYKECFmOM3MLSVUNj fe0ZppqpeSJyovYRNAAVKcyZMyDFR4DtOpagM3/XVquXASNwsmuvTB25NLcaWz3L3Ucj 0LN6xQ9ndwnaBGM+sk3pYUfdfOtXc5KgxT3cqRxk2OUBQOh1SU1FCEA7ec8VcAKYhjlQ TpAEskefgg5xmC8f90h6tOYs4iNzQFsMyH/TZjSk134bgvFDcQ6sBCXTAoZF3znkpObz zclEuugs+nDXk2Zz9B3R4SOrWYKccZD+h0sFl1xlcY7a2v8qFI6fnSFcdaOONl/2lBsA gvUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181728; x=1728786528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DoSnKsCafEyqo0X8z8XwraZSkcHXlpNQF2EXgefwFyU=; b=VTdpgMKvNqFBMVX3BPIrzzVJiqisdR6/nyUDhSWXac7wHM/IIh3/U+RvxXdkzGv2y9 Haeiu7qDXieKU6n+1Qu8bf48CgO5UW7f//WmjiSw8DP1e5wSAyMroqRNdKJXa0Dp3W5f 040K1JQCeWwCtV3b7+z5nQpODyQJ8heTeFZzETChybr6EvkegDRmmBVaVwH4YOyhxHKk IC6hgqWgNWnkCoAIfDmL+KQ+4oUwWXUGBU+6wlVq2klr+v7QVauYtZXQbPZ4R0a/lNrF 4/M23VNOglgTAjCkQcESvSXKi5AilTNWX/3f8Bvsa8b6vSkC/6l64PquTixx8Bhofd7s YGeQ== X-Forwarded-Encrypted: i=1; AJvYcCUVsEZA66l4AbRRWynrf/vu2s2lBBxx+CDkzCXt+gKc8lCmpSl4hubYSNfT2LF2h+OUv72dl6Te7HqvDVY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw62sDVeDF6/+lZR2EAFW6ZmTyxeeOwqcVSDZUSP2YdFD/EkEgc +pq4d0+9IlCbved7gXEMYHVYETy+y3LhZDDxISqPIvziL6cPReLzaN/hmQ== X-Google-Smtp-Source: AGHT+IFFynocdacD6Ln/TQul555D5kfu/nf14dPUR5eC+l/2etYoBBtuFiNT46qlQyy/Fwfd421c9g== X-Received: by 2002:a05:6a00:1906:b0:70d:2621:5808 with SMTP id d2e1a72fcca58-71de23c6976mr11999143b3a.9.1728181728059; Sat, 05 Oct 2024 19:28:48 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:47 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 01/14] net: ibm: emac: tah: use devm for kzalloc Date: Sat, 5 Oct 2024 19:28:31 -0700 Message-ID: <20241006022844.1041039-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/tah.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index 8407ff83b1d3..03e0a4445569 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -90,28 +90,25 @@ static int tah_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct tah_instance *dev; struct resource regs; - int rc; =20 - rc =3D -ENOMEM; - dev =3D kzalloc(sizeof(struct tah_instance), GFP_KERNEL); - if (dev =3D=3D NULL) - goto err_gone; + dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct tah_instance), + GFP_KERNEL); + if (!dev) + return -ENOMEM; =20 mutex_init(&dev->lock); dev->ofdev =3D ofdev; =20 - rc =3D -ENXIO; if (of_address_to_resource(np, 0, ®s)) { printk(KERN_ERR "%pOF: Can't get registers address\n", np); - goto err_free; + return -ENXIO; } =20 - rc =3D -ENOMEM; dev->base =3D (struct tah_regs __iomem *)ioremap(regs.start, sizeof(struct tah_regs)); if (dev->base =3D=3D NULL) { printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - goto err_free; + return -ENOMEM; } =20 platform_set_drvdata(ofdev, dev); @@ -123,11 +120,6 @@ static int tah_probe(struct platform_device *ofdev) wmb(); =20 return 0; - - err_free: - kfree(dev); - err_gone: - return rc; } =20 static void tah_remove(struct platform_device *ofdev) @@ -137,7 +129,6 @@ static void tah_remove(struct platform_device *ofdev) WARN_ON(dev->users !=3D 0); =20 iounmap(dev->base); - kfree(dev); } =20 static const struct of_device_id tah_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 620651422DD; Sun, 6 Oct 2024 02:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181731; cv=none; b=tlP6fzt+BqzyDUUbmWF4OFxGCNaFKvNsktDP+GC14dYkr1TAlQ22bTldW87SUbP3dsL3vNiTHZg8fk+hE9S5CK6wnEpnq5W9/wadVZDJXrnztBtEWa8YBDXBIsOih6wjapKyNuDGLVcz0y+7DAghqDkqlKt5K/SkQ/edRnF2xeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181731; c=relaxed/simple; bh=b50qnG6pMys52eOHwKFSgjZIQ4k9O1nAgimjm8DeqOk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ftzAA2WEnIz8TJlYP4xJ6QF0DboukmlAsiIxxQPw7jhygNChCCV562/t1xbY7z6187wXnE5dQNfvzuQf7qzFFYzzDO3j9rkhi35pvSsMhm3T/jsfJ/hO+UbpVbAHZGZw/dmueoAC3S8fp5WuhbqPUVMcGbCjiPEolm5/BIBuUX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hm0cC6z7; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hm0cC6z7" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-71df04d3cd1so1185792b3a.2; Sat, 05 Oct 2024 19:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181729; x=1728786529; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FlgYmcfxyeSEbv5swLRH5EW6gIaT0idCEkPjoDiudE8=; b=hm0cC6z7HA7ht32wH8yXHsCuiNPQ0ZpGMTbVfimkuzIk5FhoIvjxKle5TonsQiQsfH HtTaCoe7FYbsrtZ2rYpK52xlkp1WK9dGxz7mH8LcVm7tEgUOa2Calb42ybAPc0jLMkDB e/rXW4mv0Esj7ff/ZMO7GC2mDUA5AynPbgOuMKgNz+MTwMMNuKIZwnEl2PW/ZvIkxZ7a telEj5JpHFOJUoGYTQVkEAxAKMN3huCcGsRUrfW6z+sR4lNFLLfJ01S8WCyUyWa4kIP4 OYpcGgMoll/IVkjNfj5bOWMKIA0q9aY934/pqG8FkF8mTkT4KdqGK8xqNAKTUAJB/iPl vtHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181729; x=1728786529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FlgYmcfxyeSEbv5swLRH5EW6gIaT0idCEkPjoDiudE8=; b=I0KJogaKUwhd8DdOb/x/H9hFFXA3xbyhx78c2SWelJ6KQP1sOPunfjRVOuXJmuBjfQ 1U4g0OPzQJS/gZIzjW4RXAutnuPwG/2sOBjxqkKD3g8kEpbffpQRCgdRWFZSAGoU4Nm5 tguh7ifaJDVig+v5e2IHuI7IFzlU3x6evumN9V/5NNq6OSKdj6pTouDZkaH89ftgIefW Bix5swORR3AqLz3HOLP92sKse5mrOHw0thL7VJoYyENlhXwrm1B7+fl1Mtdw2uuOfkXo Bbvx8n06ngFzkbXIND9jG870t04NtWUy5XjXi1hZtV4OaDsTWr/mFz2g23rU11FNGKN0 62Ug== X-Forwarded-Encrypted: i=1; AJvYcCX8HPnFoEbaXZ06tbLHmGmaAL2GqRtAzdgEs3Ob8SjOdFqht2JyX+MtIOH5m2srjluZGPNkOemc7rl65VI=@vger.kernel.org X-Gm-Message-State: AOJu0YyjoFrLFLcCP1nu+gx12JVmS3BDkhBZq2X1xCxrVruy2LI4ITHW GvC0jp9AldZccIFq+sP6UeWlkrtjFCqgS4zr/0rKLUvgZ/JBJ1CA34/9GQ== X-Google-Smtp-Source: AGHT+IHYy5xcGzIXbac+/al9t6Cbds6LST3+hqLeK+HpHNYGTnRYzMsg/pKLnmciDRuPsHJ7CGhwjQ== X-Received: by 2002:a05:6a00:8c5:b0:71d:fe19:83ee with SMTP id d2e1a72fcca58-71dfe198709mr1680031b3a.10.1728181729456; Sat, 05 Oct 2024 19:28:49 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:49 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 02/14] net: ibm: emac: tah: use devm for mutex_init Date: Sat, 5 Oct 2024 19:28:32 -0700 Message-ID: <20241006022844.1041039-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It seems that since inception, this driver never called mutex_destroy in _remove. Use devm to handle this automatically. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/tah.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index 03e0a4445569..61f70066acb0 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -90,13 +90,17 @@ static int tah_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct tah_instance *dev; struct resource regs; + int err; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct tah_instance), GFP_KERNEL); if (!dev) return -ENOMEM; =20 - mutex_init(&dev->lock); + err =3D devm_mutex_init(&ofdev->dev, &dev->lock); + if (err) + return err; + dev->ofdev =3D ofdev; =20 if (of_address_to_resource(np, 0, ®s)) { --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E016816B3AC; Sun, 6 Oct 2024 02:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181733; cv=none; b=bRKU1LAggQkRHNhK1hjw4VVuV+LkzUbF7tq6+KKLrFyIizor5d4WOtuiTdzV3vDjQLaqJZA1Jwlhxxg7yzEdo04wgI8PViwkmS7O59IoqK4EZreP3sLRu4XGvTk7PzoMkJKUVgySBmphXMGbMcTDvp9wEkER2o6OhBhEjFjnSHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181733; c=relaxed/simple; bh=cGZYR46vn3S6kBIU/qW5wOJ10h0hXB5KoiQH4dgiaCM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o/OXbM8Co+EO0YrS9YsMvY0JqZh8z+g0H8rqJUOkMRLMkeP3kc1HTl8DKO2SSYZINGEJn10iFCZvFjJ6SWB2rQAhYd1ICnQCG+leLZjsO0lwRujPBsz3rGXv3RT3TpRgV0Gb+jEQUkiu7JwKYmVhOy8NWm5LWlgZ2+WyhICvHsA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hn0snmzK; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hn0snmzK" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71dfc250001so280082b3a.2; Sat, 05 Oct 2024 19:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181731; x=1728786531; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0ZXLrsBCw6gVIeraVKvj6MQahlne4BpDoCPrU6lTBVo=; b=hn0snmzKtqaLRFlSDokUkIfHZFxx2nbxnE18U7hI5j8c/XCM0sQlCF3FBvYllXl+LX aYaDmkALmj8o3IIM3nf+A21XeQPBvqv4l19fzQtguADWcTSFW4POvJUr60JHGcCUtYUu RwT1rThvtucQe+JBaqQ2QxBCHYck6tOVVAlvPpR7pX99T4FHBR9W2VXJa3mvKgh74diI okvy6mKp3fWdKOZDjuqrDEMEx+aUgagaj+OrEyw/Rs08codlZ3Y64NJnSKa8XuqlJIuZ z3LYD2LZb7Sj+v0rmN0G7sAsQjI+UN5jFckR5Xi3IIf1533Y3RnB0tO3MuaF8ZiWjyAk zm2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181731; x=1728786531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0ZXLrsBCw6gVIeraVKvj6MQahlne4BpDoCPrU6lTBVo=; b=wd5bdydlnZOxGYQRySJuLVAJDEdfw8sD6PiqySTtUqX/EgyveU0Os5ggNKn9zUaiiy otqLJ2dQmrg1fcXd2p5O3vx1TKjUJnnuxHMgRBZOX9ke10KmeQyK1kvZTpGQpeRAhd8x UdSdntWRQEiPhtcx3cZDAXqQP0FXkGlsDxHhjsO0LW2iUpQyaKsBiGPiKuS+sLWOMg+G AphRvcBDI74hqwxtdlwahpkzpvBqqewhfd8Fuu2VqvHm+ee9V25e0SEweLk9RHnLABmd 2J5Xk8rENz9MIPEO5u3Ohl6JhsH0lAqvBgD1MEXgjyDh+ZvzgYjI6XObVmgAi234GEOQ iC9A== X-Forwarded-Encrypted: i=1; AJvYcCXrdGX/2hniOBCX5hPiTpCMnpa2S7NPWIIdzzheb6vC5nN5Mkyjao71WTMTraCi7jsCRgKwXAIC922WQ8I=@vger.kernel.org X-Gm-Message-State: AOJu0YxEICLWvWXbRaFxZQxC5VamsLDpfVDAFGlRkjQrroU7h9twGV5T 9GO7LJo1jubhaRTMelqwEWV1uyzVc8GENjCfA+7erHMOqnhBxFBmwCyvlg== X-Google-Smtp-Source: AGHT+IGhBvdv+XZZ61TnkJvrsUwwh8dNSdU4vvOUV4bxp9Iq0lFzTfp7JY8zh3nhmrw3BcCZYY3trA== X-Received: by 2002:a05:6a20:d045:b0:1cf:32d1:48f with SMTP id adf61e73a8af0-1d6dfabc7a1mr11274192637.36.1728181730940; Sat, 05 Oct 2024 19:28:50 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:50 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 03/14] net: ibm: emac: tah: devm_platform_get_resources Date: Sat, 5 Oct 2024 19:28:33 -0700 Message-ID: <20241006022844.1041039-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by a bit and allows removing the _remove function such that devm now handles all cleanup. printk gets converted to dev_err as np is now gone. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/tah.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index 61f70066acb0..9e7d79e76a12 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -87,9 +87,7 @@ void *tah_dump_regs(struct platform_device *ofdev, void *= buf) =20 static int tah_probe(struct platform_device *ofdev) { - struct device_node *np =3D ofdev->dev.of_node; struct tah_instance *dev; - struct resource regs; int err; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct tah_instance), @@ -103,16 +101,10 @@ static int tah_probe(struct platform_device *ofdev) =20 dev->ofdev =3D ofdev; =20 - if (of_address_to_resource(np, 0, ®s)) { - printk(KERN_ERR "%pOF: Can't get registers address\n", np); - return -ENXIO; - } - - dev->base =3D (struct tah_regs __iomem *)ioremap(regs.start, - sizeof(struct tah_regs)); - if (dev->base =3D=3D NULL) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - return -ENOMEM; + dev->base =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->base)) { + dev_err(&ofdev->dev, "can't map device registers"); + return PTR_ERR(dev->base); } =20 platform_set_drvdata(ofdev, dev); @@ -126,15 +118,6 @@ static int tah_probe(struct platform_device *ofdev) return 0; } =20 -static void tah_remove(struct platform_device *ofdev) -{ - struct tah_instance *dev =3D platform_get_drvdata(ofdev); - - WARN_ON(dev->users !=3D 0); - - iounmap(dev->base); -} - static const struct of_device_id tah_match[] =3D { { @@ -153,7 +136,6 @@ static struct platform_driver tah_driver =3D { .of_match_table =3D tah_match, }, .probe =3D tah_probe, - .remove_new =3D tah_remove, }; =20 module_platform_driver(tah_driver); --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29CA116EC19; Sun, 6 Oct 2024 02:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181734; cv=none; b=Q8ggRwyhwh+DIkOV8n5RisepC9jsh42mD7okJ6NP46xnAOeeeSnAlS7uThYglH+OTuW1Itx8PWA9afyn7t4TbQmMqjibip9Abm+dyOAO+CT7426Os1kys/mibqJfmscU9+XtA/sO/+ZwVGymFK1DSwvIyMCqfIAZWElgxhnZHR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181734; c=relaxed/simple; bh=A8gJS6fEP9QvIScx57iYcjbGzw0KGh8cHqIn3dIOJyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DnOgoVfIPD68KxrJIrxkfZOsAwwQHvRJ7WOefADxF19oW8xIrbal0d3cTJIn9oXWNdLt3/XM3SfqymjxUH/Sbdq6F6a7q5D3DipfIt8eh9lD2Qzb+uzHku7Dwe5aoQ23ioUPa2S1xSRDBXXoqjMcUiYT1u0mG7m/Hv0oAqso/hk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Dh7ydFls; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dh7ydFls" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7e9f8d67df9so648927a12.1; Sat, 05 Oct 2024 19:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181732; x=1728786532; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IT1fHxwhP5+cPvxE4VxQE/C0xITWVI3wQQyc3orisuY=; b=Dh7ydFlssKJm6M7HdnBOD9UGwcgpYtzoseW5YrxUYpLcVcI7ovhTDExAEVHOKvMjU1 3JFEamCgamASf9zu3ch7viPh0IfDM8iv2v13XTQvlND+Yy9Rf08cQ1fzn146sECidLa+ FTx5vfiMYyMDc58f0H6L9RyQ9uJB5NCzdD3pRc4EHFVftrlqxrIum5M4tHWCp8XsGdHw PC797NVk4aV9DSGtphcgFTeAJvdJyFRh87yH6xT8efufsnIj2kB7PgbKdy1NIFqVgdv8 PiKgYFwR9f+ngOsY2J6r1MTmCJJ9iEKVm41BuHJP9OidWGesq1eCkLGo6ogTZ7jxc6lD fg0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181732; x=1728786532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IT1fHxwhP5+cPvxE4VxQE/C0xITWVI3wQQyc3orisuY=; b=ETWgFIZI5FoZ8h0Mf3oXC6rrfLG94bZ5qWLGXhltIy3IisEWeqluZoAFiKOHzfX3P8 5grIXw3li/z6RqnO0QvAKT1nmkAFcAdsHsoTgOi8BeoVwQYsoAJKcSiHN/1SRWSaxXda vzQ0m2lGZyU/id4Rq28CJOSlrIPBELFpsoT8Dg+i+H8VtvIk7/5Pa7+unSi7DoYF1EGT 5TF2/Kya085eOjP6VyQ84fhgA4hKNiiZ0oNLIx80bjoukK1xPXVcWGR87ILlNND0FtVR SE5x7zQa0NyGnwsKTacPP4q8xoUcau7GKlU/GNP41vrKYEOILmItaNZe/HHt2Af+qxnx pbjQ== X-Forwarded-Encrypted: i=1; AJvYcCXwhYUe2PkJ/ISIFWtBZwW81N/MDKZuo9e+6yIQCsFJlQTDIW8cvmgb5am7cdk+6X+944BVHyL/FVnE8Co=@vger.kernel.org X-Gm-Message-State: AOJu0YzGYZ39iSz5F5sY9Y+DftDat29ponFML5uo3IiO5Mim+9Ax8qxQ F6wfy5Ao5PO1s8zU+8sfdDbW3uzUtiZ1N7uEpX7CbQC+BP/J7P5200sSCQ== X-Google-Smtp-Source: AGHT+IHs0PyY14tzlzORYLFdsbKSqyNOPGmGaa1vZ5h7M3v6v3NrUU/TFRe9hKhxDHE3rbaCWR2VtA== X-Received: by 2002:a05:6a21:3414:b0:1d2:e888:3982 with SMTP id adf61e73a8af0-1d6dfa36971mr9474007637.19.1728181732301; Sat, 05 Oct 2024 19:28:52 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:51 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 04/14] net: ibm: emac: rgmii: use devm for kzalloc Date: Sat, 5 Oct 2024 19:28:34 -0700 Message-ID: <20241006022844.1041039-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/rgmii.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index 52f080661f87..8c646a5e5c56 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -219,28 +219,25 @@ static int rgmii_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct rgmii_instance *dev; struct resource regs; - int rc; =20 - rc =3D -ENOMEM; - dev =3D kzalloc(sizeof(struct rgmii_instance), GFP_KERNEL); - if (dev =3D=3D NULL) - goto err_gone; + dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct rgmii_instance), + GFP_KERNEL); + if (!dev) + return -ENOMEM; =20 mutex_init(&dev->lock); dev->ofdev =3D ofdev; =20 - rc =3D -ENXIO; if (of_address_to_resource(np, 0, ®s)) { printk(KERN_ERR "%pOF: Can't get registers address\n", np); - goto err_free; + return -ENXIO; } =20 - rc =3D -ENOMEM; dev->base =3D (struct rgmii_regs __iomem *)ioremap(regs.start, sizeof(struct rgmii_regs)); if (dev->base =3D=3D NULL) { printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - goto err_free; + return -ENOMEM; } =20 /* Check for RGMII flags */ @@ -266,11 +263,6 @@ static int rgmii_probe(struct platform_device *ofdev) platform_set_drvdata(ofdev, dev); =20 return 0; - - err_free: - kfree(dev); - err_gone: - return rc; } =20 static void rgmii_remove(struct platform_device *ofdev) @@ -280,7 +272,6 @@ static void rgmii_remove(struct platform_device *ofdev) WARN_ON(dev->users !=3D 0); =20 iounmap(dev->base); - kfree(dev); } =20 static const struct of_device_id rgmii_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AE161714B3; Sun, 6 Oct 2024 02:28:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181736; cv=none; b=gphVhDujWrqHCvfZJ6VfYAdNLV7T1Vu4ZA3RgXot35PoybyI1vPEovxsGqm8DqKbLV4ctJbsrFW2VrLEBb/0xp4vNbdvFGIiTXqAsJBUFLrzlDy9xeT0NtxHShvUv9pzPMqbSRqeGQaPtXKurCfIXqdDkK2nJpX1BRmF8YPksb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181736; c=relaxed/simple; bh=/cSmNYS6svmoBzDEWOXGBTlXUAGxIIXjQhNn2B2N0g4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=czZlSkV5e/7NU57LQ8nTNz0mVJ1ZC1mLH01JdH8lHSDPjKKssOf8/kALrP/65eLUK8h1qLeJZs9vHRp8yXN2F4x89YakV4dD3an3zpA/dH/YFh9DxC31xHK7I4XkFXxwOWrf5X+j+mFJyZXyEPhoabe0RO1wP7Lqu3XhOaeZ9pk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Lj71HrSy; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lj71HrSy" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7ea06275ef2so75022a12.0; Sat, 05 Oct 2024 19:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181734; x=1728786534; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iZMKp6EdgP+kd80Kbn0C8MSGwrx0pm3qzbGcN5gpVOM=; b=Lj71HrSy+TajlJDjLtoC5Rn0PGMS2iKkhP8YfuXxnoSJSA1tbPBZBNLLADlfpobvVa O88Oz5wL3DmO/pUuXrGAY32ttsmle2nGHlzlZXlhHDmhtBmcrXr0yqqQC7R+MLTwY52x p2lScyE12+qwJSNy6qV3UPklgP4yEGfvDa8Oi6BRDzdJF2cwOP2PXv9i08JozNbrSc2f KGK26oR/72Da0v0h1rzmE+Uc3Fad/sBWY7OD1yWII/se3jr3vscwJBdZIUHtUQn2W306 hrGfMIQrXEMwgYialUIwXhorMgbZWtsln+sGMsnbPgHwYrd+VQF67Ln8Wjm/iijbjy7f IPzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181734; x=1728786534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZMKp6EdgP+kd80Kbn0C8MSGwrx0pm3qzbGcN5gpVOM=; b=HrJGTFDQ+OgfmoAlWaAF3effDcsmfc2rnIwWIh1ezdWCBhMin4/Pt4sMARxX6XJq7N JbPfTEv/SSAyHmyHPd5dXr84NU59GRIMCxacaFqc7EP/n2o4su28Odch68O33eO//N7M ud0T4XkKDjLelCV77hfJr/ukO5XcjNOEQ5DMhCQHc+LVU3I43LZ68VhEJu6rWfNIsbel pkdoL+EzQK7rqtGVOA0wiE7D7ppvx0DwbzCA8ZDuzMhEu9mOAqaI41n6copcD9MnJAA+ fs0AmI1eN5xZEBDw92gAhmiqPzXxF6y4qGxHfHUZ/iDrENbt0gxkQsPTf/wi4AYkUrfI K+PA== X-Forwarded-Encrypted: i=1; AJvYcCWtCyQVigDSP9n7tuyjWrpxdMGL1RBq+yKNIfhsOTd3/EA9Q5DaKH91fVP43QUnkUxIqXSlfA3AJ9ssUz0=@vger.kernel.org X-Gm-Message-State: AOJu0YyZkT0RrH8iFyXJeyIAI0UN+o5XZodQwdzSrfAN//EAv2HzUVMb PPnAeg7GmIo/8rBWsiNklNYekjvmATDTaHBLQfelQhoebGy554IdyEc3sQ== X-Google-Smtp-Source: AGHT+IGfNBLRL0S1yfRCd/wzLRD22Pu451gWjQMiWrNTkqQBp9rSFdLMd5DYhqzy+XAysPHGILntjg== X-Received: by 2002:a05:6a20:d521:b0:1d2:e8f6:fd4 with SMTP id adf61e73a8af0-1d6dfa476b7mr11267759637.27.1728181733778; Sat, 05 Oct 2024 19:28:53 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:53 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 05/14] net: ibm: emac: rgmii: use devm for mutex_init Date: Sat, 5 Oct 2024 19:28:35 -0700 Message-ID: <20241006022844.1041039-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It seems that since inception, this driver never called mutex_destroy in _remove. Use devm to handle this automatically. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/rgmii.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index 8c646a5e5c56..c2d6db2e1d2d 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -219,13 +219,17 @@ static int rgmii_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct rgmii_instance *dev; struct resource regs; + int err; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct rgmii_instance), GFP_KERNEL); if (!dev) return -ENOMEM; =20 - mutex_init(&dev->lock); + err =3D devm_mutex_init(&ofdev->dev, &dev->lock); + if (err) + return err; + dev->ofdev =3D ofdev; =20 if (of_address_to_resource(np, 0, ®s)) { --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 314ED173346; Sun, 6 Oct 2024 02:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181741; cv=none; b=OBVPGpAeHz2e5FN2GbligOstraQ1HzN9gvakJZMQQoVN6yxwPttQokNrRyHSvxIGSy2xbOgF5AdxYkbSYOeOYO1ziQKXUXPXyS8CP9VRKK3axwF6ndUzy1ggg7LVUewPtFYByHrE17ryIbi66s2Xu/dsvRQ5kcUxR93QDUXc5mo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181741; c=relaxed/simple; bh=CuSawRtUbFVk8tjigxOGLqZMKxwZi1krgDcvB/Wmy44=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RQpkpFqZXU7gH0AB92TD+6ylh7gvbykFziFDB7lxhlGna3waaWy8wObMTkV/KjLBAoEEo1Z990yBpNWrX5TVif5xWAHmdYpuJRDr0nUOtSzHbqm+LtCmJ8od8JL6P43qVdqOrCj5a05T0HCHSJuExQZmyi5RWnAgQ8DIbHfPgcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bEgdBaRk; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bEgdBaRk" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71def715ebdso1014005b3a.2; Sat, 05 Oct 2024 19:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181735; x=1728786535; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pu9sszKQ8Z1oBJqpg//vV/J/jxjAV4Pvvbpsa1C/uW0=; b=bEgdBaRkY0yAzNp2CBArwnxPG127eWLrQh+Ybkq/vdLRb9oSBSg+8CiSBb5NZ8nHP4 EqE5tuD4rTGzStHcn8fov9nINsYuWkmv0uLU2I/EACZBIyJPLBzJG/mFj+umV7R+0MzO hmoOctBex/2ARnF19uWDbYTLRcAyOJpUzlkhiYRsmDqZAoBO6hwYZp3e6xyCBAubNIdj hX/HFEIiGAJUMmPiG3RHHVPktZe1JwoJDe70kYkg+6Zzn5JEAzcE9UY6veBp9dAIQL9v 69Yiymy2TzO551jQwEiM69/UPPymK/jPBxTvGDAP+SuxGIymiPu0gY3zcPNtJzp5EMOM mYWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181735; x=1728786535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pu9sszKQ8Z1oBJqpg//vV/J/jxjAV4Pvvbpsa1C/uW0=; b=i1F4iOS6ivJJbAZgS8fqppXIVq3vL5pT2euj9kble7O1s9OWDmXVU71wfH4KUnmO8c IbsE0GggVBqc85h511F3zlxgpZXWgiu/pIonBOrnzGn7f4DXyZV9Rm+V4qg5SsK5bs17 IvMWwSQFbXgaGgDQwv2KBODAhkKH9zodUNSkEXrmuWHRNOSxJXuXxun26hbD23C9QqDj iZ2jzGCtGIR3Jnr7fXEdpfXvoKl36sNxgXGbdtAf3Vg/PeG8ptIyDDvl9ObXzD5mT7k8 2IAgGIBUl/QobsaRCKpSciVYLHwvI3R9tiXK1sc918lWMT/KiC+mqNZJ9l1wSRRWp8c1 DjQw== X-Forwarded-Encrypted: i=1; AJvYcCXmFJoV0ADGkBHSMmILtqZILYdtcozxLkbT0MUUCoRSCywDOOCvA1a2sjQqlnhNqK+AsgYaIfC7Z3e1uIY=@vger.kernel.org X-Gm-Message-State: AOJu0YyJFJlJFMTaftz4MAYg8YH5vhdWfcGdYt4SF/49JFARPFcpkjLU sRuA9Dl3skOalzjsUSpXHOLmJ+rh0xG6hKJ3lMzTuXxbziF07ZANNxTKVw== X-Google-Smtp-Source: AGHT+IEBVX33/dzewGuMaHshwlOznwaF2SCKxizWB0cuhI0fzuszsfC0deJkrrfYvrPi0KNQOYffJQ== X-Received: by 2002:a05:6a00:a88:b0:710:5825:5ba0 with SMTP id d2e1a72fcca58-71de2399c86mr11842372b3a.3.1728181735233; Sat, 05 Oct 2024 19:28:55 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:54 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 06/14] net: ibm: emac: rgmii: devm_platform_get_resource Date: Sat, 5 Oct 2024 19:28:36 -0700 Message-ID: <20241006022844.1041039-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by a bit and allows removing the _remove function such that devm now handles all cleanup. printk gets converted to dev_err as np is now gone. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/rgmii.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index c2d6db2e1d2d..6b61c49aa1f4 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -216,9 +216,7 @@ void *rgmii_dump_regs(struct platform_device *ofdev, vo= id *buf) =20 static int rgmii_probe(struct platform_device *ofdev) { - struct device_node *np =3D ofdev->dev.of_node; struct rgmii_instance *dev; - struct resource regs; int err; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct rgmii_instance), @@ -232,16 +230,10 @@ static int rgmii_probe(struct platform_device *ofdev) =20 dev->ofdev =3D ofdev; =20 - if (of_address_to_resource(np, 0, ®s)) { - printk(KERN_ERR "%pOF: Can't get registers address\n", np); - return -ENXIO; - } - - dev->base =3D (struct rgmii_regs __iomem *)ioremap(regs.start, - sizeof(struct rgmii_regs)); - if (dev->base =3D=3D NULL) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - return -ENOMEM; + dev->base =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->base)) { + dev_err(&ofdev->dev, "can't map device registers"); + return PTR_ERR(dev->base); } =20 /* Check for RGMII flags */ @@ -269,15 +261,6 @@ static int rgmii_probe(struct platform_device *ofdev) return 0; } =20 -static void rgmii_remove(struct platform_device *ofdev) -{ - struct rgmii_instance *dev =3D platform_get_drvdata(ofdev); - - WARN_ON(dev->users !=3D 0); - - iounmap(dev->base); -} - static const struct of_device_id rgmii_match[] =3D { { @@ -295,7 +278,6 @@ static struct platform_driver rgmii_driver =3D { .of_match_table =3D rgmii_match, }, .probe =3D rgmii_probe, - .remove_new =3D rgmii_remove, }; =20 module_platform_driver(rgmii_driver); --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 660D3175D2C; Sun, 6 Oct 2024 02:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181738; cv=none; b=SdOMZu5PK+oX6SlCT+F9BP+af69noyqjn5VTc/N0F4vIYEySZ1lU4Txz/L7clGv1CBVfnTvL6Ie2JmsJZirX73jcVXGEPnBe16fCgv3CtvePy0HVf2JGSqvh1gtlZUnZjBXDTskmVRHR/88y4Qfw16RXUXGegAgjeA6W1MzFwQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181738; c=relaxed/simple; bh=jcEPPiC20NiN9gN9PQRjLJGI4IFmPIwO1pV6PvaDEDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p2UvYsL+KSn8HNbKBgoHgPs5l31I3cyAQ6qU0oa+yDioCbmRuHCJO8i2pefYJnaRVWhOoR1t3Wgc/OD0O0PGXpXgXUBRX3CVDcmj0MR8Wf8sCvxbGihnInPcPO2w2E1QfbxaZUj1nX6/HVsBaf8Q3J34hWh3om2JxTytmulbfDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bWQwdOrP; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bWQwdOrP" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71df2b0a2f7so745586b3a.3; Sat, 05 Oct 2024 19:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181736; x=1728786536; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z5PeKEFZjGrSAzWG8C4rr3WYbWfyAh6vUs2OEDpSIRE=; b=bWQwdOrPqrWxkv5a5HDBoQsyDe2268+j2W/Es4k46SHMbnL2xxXIrq/AT33kraUynh 2df4LhXJ5eEqGBhsSpmfGz+RPZL0yLNsvnv8Rnq+MRq/vsfa+G6hYCy/tXRoTMOCmf1U vJfN2wpN5Wvkve170HAzSPBfvmCxRdCoM735h9y1fpMHVMLCBIrm+OZHn8nnrAxa0AXX mmcC3w80ipKColuSjsS2gnKhY/Q/XnhHHbxFXUTir/cwewx7WVtzogfAIwnkNAnBytd1 tvCAWmouGU7pBAO8aokvt5vWNS0Hl7Y6f+2/WZXPFuWN9cWuwPfBopwEAnEg3u8VdAKK Ov3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181736; x=1728786536; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z5PeKEFZjGrSAzWG8C4rr3WYbWfyAh6vUs2OEDpSIRE=; b=ExPJlM69+rP4t6J7+UJCBech5sFdTkDXFJlx9Nm3mtMdSc9RdKKImfRXugLxHtW12K IqQ8oNjKW2IOZzQ7FGIKVsK93koukAYMYRvNdEgIcQJ/PZgCnGCqW5SL8r44lM+unkGE iJMgK+y6AxHq+6w9hJQTqYGPBiDTOG9qwPgnZSpgBwQ3g4OJgyAC5nVhyaU3Zom/w91I 453q3o9LyJAp8Rcis4m6KFfadvT9KyTpRyvgpntxMuMwzzzx+yq0e8Ha1ivGDDhF6Pzg Z3Hd7r4RRoOZz21JJjwQUP78omHHPX/uyVZJrawH0D2NqzzC1aRs6kIvV3fZWW9dN09c tvsg== X-Forwarded-Encrypted: i=1; AJvYcCUV0E8YtLy2MtE40W/XrEG75DD6lgnbOSGShdCdrQ8Wpw5c8n0PRpOGILErYsVIqLJ/Q0CMy5iD3m/oIWU=@vger.kernel.org X-Gm-Message-State: AOJu0YybMO/+1k/AdDwSTEW+nb83DsBpsG7gLe3Xo4QW4+8y1SpgGwDs XuUwY0FpL4hYVeP4gZjQIfeIwoTevNGQ3qBz2exy/1cE9UGRu1NZJMRSOw== X-Google-Smtp-Source: AGHT+IHYr7uR7Xq4KpE5L4tixlUeuHwcMNjFvprFNaUiOJxHWcpkvI7z2o4wUGZjPsIvybsJTORI8w== X-Received: by 2002:a05:6a20:bc8a:b0:1d6:f623:1798 with SMTP id adf61e73a8af0-1d6f62317d7mr1374928637.14.1728181736625; Sat, 05 Oct 2024 19:28:56 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:56 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 07/14] net: ibm: emac: zmii: use devm for kzalloc Date: Sat, 5 Oct 2024 19:28:37 -0700 Message-ID: <20241006022844.1041039-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/zmii.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index 97cea64abe55..c38eb6b3173e 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -235,29 +235,26 @@ static int zmii_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct zmii_instance *dev; struct resource regs; - int rc; =20 - rc =3D -ENOMEM; - dev =3D kzalloc(sizeof(struct zmii_instance), GFP_KERNEL); - if (dev =3D=3D NULL) - goto err_gone; + dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct zmii_instance), + GFP_KERNEL); + if (!dev) + return -ENOMEM; =20 mutex_init(&dev->lock); dev->ofdev =3D ofdev; dev->mode =3D PHY_INTERFACE_MODE_NA; =20 - rc =3D -ENXIO; if (of_address_to_resource(np, 0, ®s)) { printk(KERN_ERR "%pOF: Can't get registers address\n", np); - goto err_free; + return -ENXIO; } =20 - rc =3D -ENOMEM; dev->base =3D (struct zmii_regs __iomem *)ioremap(regs.start, sizeof(struct zmii_regs)); - if (dev->base =3D=3D NULL) { + if (!dev->base) { printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - goto err_free; + return -ENOMEM; } =20 /* We may need FER value for autodetection later */ @@ -271,11 +268,6 @@ static int zmii_probe(struct platform_device *ofdev) platform_set_drvdata(ofdev, dev); =20 return 0; - - err_free: - kfree(dev); - err_gone: - return rc; } =20 static void zmii_remove(struct platform_device *ofdev) @@ -285,7 +277,6 @@ static void zmii_remove(struct platform_device *ofdev) WARN_ON(dev->users !=3D 0); =20 iounmap(dev->base); - kfree(dev); } =20 static const struct of_device_id zmii_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 119D8175D54; Sun, 6 Oct 2024 02:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181740; cv=none; b=CEC4mYnbSvft7YtDBb3TEXQAsNRl3MWimVOqtEBzkJanzBWsbtKhBG8mGva9Mqcw7p2W6cx6DNVXr6oMVC9byyRe8atX+6NSnAeTqZohx7YProMyR9GCQUklbavv6tfLiUlAooKjrxaCaB3eTym/7Gw6sSWTCrxq4FTkpkTu6Ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181740; c=relaxed/simple; bh=ygxRrGdJ9KUgzvWWQQm+pKJqPtp9dK2gVLxXFBftRo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZDcsNZjZCcecSbWg+pQjTaMsc4dzqYXzLvCinqGDaUiwWqkEIbMF2Ddmcna343NGUNz5YLYLADrPiW+DCq7qEO3tjeKG8USGvGK/65P9N9NTVbo8+BVblaPLOXFB8qRM4Tm7omOJRYFux7KnzWND/3MDSvjZrc0NjElvBE/w0h4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RriHha+2; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RriHha+2" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-71df2de4ed4so508044b3a.0; Sat, 05 Oct 2024 19:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181738; x=1728786538; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B0ntunKKFgauuU5ev2XToJi6VDmF8czZ8ZBzTnd02HI=; b=RriHha+2tGHow+cx00n+XzaU5lSXtKlD1MKkkaI3WqGo+1nFLgzfGh80C0Li0ii4PI tqdlaP7oO0tgAoLCN/4xY0JmhB+Bg5i2toG573HE6oR0qgfcg9PfHorb53QV+wT2f4U6 jGxHmN6iAjoqkFKieYp87SixhBy09Qmv2b84EybrHS0qUL624808nfG3cL9QahDwslQ1 tVhVI5QVoU6S6d8qP978vo0u2/YSLqHlxfpFnUoFWe9iOjs7iWJu9SVEjfgbynNWbvuQ Q1uW1/06OgC83pQwabMhdpzPbkMisJT/SIn5dLwO8LtXJ80bB+a1dUDxZRm7L1XFpKKS V0Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181738; x=1728786538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B0ntunKKFgauuU5ev2XToJi6VDmF8czZ8ZBzTnd02HI=; b=ctEqKmZGKneGlpdvK9bUfVnJG8hAcuVVEeiKZFWqiXYRNpEv7UFHy2qakKihfLQB2c 5dMYBqCyfQgWII4xKohSckCJOqZhN8+NeP3R0yrp6gFP0SBOx6tszQKrB83y3jcwVtAi SAGUjnSK5abagrC90DH5uGJaza+D2RKCrtHNzLLL5uhPgRZ/Uyy2bZx9L5dH1zKqllwt k/LFo8hA/9EWF8MMRStyEezt6ArsEnnqAQLv+PTHe73nI5GJoKDNpXNJqbBL7vaBbJRS hUwa4BR5ICbVQfMcK2uYIUcQMTawUinz9ypNFXF9XtWlHcOCPbhhFAWgFszte64I/SNP lPPw== X-Forwarded-Encrypted: i=1; AJvYcCU5z57Z64uz5qkXKpOm6XZTL4qxGI6YOhZtP14Bap4A9CnjWNtQNMHPrIfOjH7UZnycfYsVpe0My1MeeDo=@vger.kernel.org X-Gm-Message-State: AOJu0YyfwtKIzZ+DTAHv9iRrHapRPQFrCZxH7IYhUl2VpWOh4Q5npqul 7JupfGz3E3GYL2xhsRyB9EJm4TEtiHFHtWp18ds8puWPMWUov7sYTI0Rkw== X-Google-Smtp-Source: AGHT+IE9cwf2izfUgWzpobqYIEp0MwTn3Yu77dl+wNb7QtWMaA3RJ1v4L4kxsywsND6QuOdPADOCdA== X-Received: by 2002:aa7:8892:0:b0:717:8a98:8169 with SMTP id d2e1a72fcca58-71de22978d7mr9733070b3a.1.1728181738311; Sat, 05 Oct 2024 19:28:58 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:57 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 08/14] net: ibm: emac: zmii: use devm for mutex_init Date: Sat, 5 Oct 2024 19:28:38 -0700 Message-ID: <20241006022844.1041039-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It seems that since inception, this driver never called mutex_destroy in _remove. Use devm to handle this automatically. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/zmii.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index c38eb6b3173e..b0c46dfe95b5 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -235,13 +235,17 @@ static int zmii_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct zmii_instance *dev; struct resource regs; + int err; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct zmii_instance), GFP_KERNEL); if (!dev) return -ENOMEM; =20 - mutex_init(&dev->lock); + err =3D devm_mutex_init(&ofdev->dev, &dev->lock); + if (err) + return err; + dev->ofdev =3D ofdev; dev->mode =3D PHY_INTERFACE_MODE_NA; =20 --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F6DC165F16; Sun, 6 Oct 2024 02:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181741; cv=none; b=mQTes1r5FjeHzt6MvJxRKvr9Z0v+4dxI1vfFaS4q67C8lP1KDXQLKlCL5acXH4fnprDN06EbbEAda/XQkve4wrzZjC/C7txqI/l37PFonIVWQhQWXbqVFNtXluBLnSHj1yN7fG8e/WOlJNaaolxKtY3lTyZ+yxS9rihtqI+CEhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181741; c=relaxed/simple; bh=1J3HkkjHl3tzny9aAzxVDp0YCbpSEdS4i7sgeMk1m4M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tDkFpM2vb+kq+dgcdaNKdPwZ4PGEzj3EbP7CQLf2Vv6Xi8bWSgMSWrcPrOTjYm1uPVmDkzBSIGZqSRcKQW4qXmP73EDpKyzrAPlq3zBmO6Udao0ia7KSGLvYRjkUtQBdle7S1TQ/1dnohu3wLuhQwBlZYtiYLqsYqN52ul3/Jpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MeoeVDWt; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MeoeVDWt" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71dee13061dso1118501b3a.2; Sat, 05 Oct 2024 19:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181740; x=1728786540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I3q8IOuT6F3mrdk5yNzpUn2+azS++gVYdm1EhDfEdgI=; b=MeoeVDWtPX1rMI9CI7UMfODKzjeiEJWuUUbSWMU5mzgDvFtnjnDqKNkaL6nXQy9cSR dIo9NUT9wWSPHXqCWtHR+5u8Y0p47OFghG62e7sdyaM15jFAp5ixVZK0bEMnGKsn/sZR iQd3/RHpOZ2zxE5koy1DLhVNlQZ7coKdlEt8T5YSv/Q+1UzAY+1eMQSio7FCx47+PMoj JVZW5+EPMnycIrrGFfqAQOvTvkVKWLtIc4tUKmWKOe6w1Dnf3jK3Z4Mubjs565CETazE U7sbe1w+DHMmGH7O/sTBot80TDFUhWs8MsDtnYysd4bzqeow127CL/HdVP+3HUI0+aQu 8pag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181740; x=1728786540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I3q8IOuT6F3mrdk5yNzpUn2+azS++gVYdm1EhDfEdgI=; b=nsSiolx1Lnb5ks4Den1mT4C0ZAT1AaMRMgbcHS4chMeA5RvcKVUCxCy8WPkIqnqgVS m9gdkLHFVdV7CIrUIbw7q0QOq9Z1ysGQqN+eRkojL2qgBYzBxeE7meSSkpAE15HFHcJl e2F1cjRHIN0taCedQClIxqeh0zml/tQH0Eg6g5/IC/D8hbjSc9ED+3YY7Ki2WVD+PBvl 4QNO6aTJCXNqiSZ4a4LSXl1UGDt2vL0oeBal03uHd90DplSQW6fafwuaWaT8t/pMCRfz uWCYAXGDZuJSXjWj396+mUP26DPwwlXpdl49bIhVE/gYn3oIpVGZvfrS0Xxybg+nGuyF G+IA== X-Forwarded-Encrypted: i=1; AJvYcCU21vy57a/UWwVzOXq/WQe2370ZiYmK+ggzHRv1U/NJVJMlqefgZZneBRG7i5u7zY4lcKfeDHCd/mIirIk=@vger.kernel.org X-Gm-Message-State: AOJu0YyzLiRWndhHip8vcPmLQ/2LWkSM1OVfPR6wmnUJKHikMY0Nf5Dz d/LHSlQUwslHm0EunKRLJTe9u7hAKr2mHdHnPXI1qcYEegMzBmrOAPo8dw== X-Google-Smtp-Source: AGHT+IGcQ78dWOeZDaCB01lY/jBzMOsSo/Q2GERF7zl1F1IIkk8aA5REdjnJT4ot01XNJLWeYyylkg== X-Received: by 2002:a05:6a00:3a14:b0:717:9768:a4f0 with SMTP id d2e1a72fcca58-71de22eb62bmr13093755b3a.0.1728181739754; Sat, 05 Oct 2024 19:28:59 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:28:59 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 09/14] net: ibm: emac: zmii: devm_platform_get_resource Date: Sat, 5 Oct 2024 19:28:39 -0700 Message-ID: <20241006022844.1041039-10-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by a bit and allows removing the _remove function such that devm now handles all cleanup. printk gets converted to dev_err as np is now gone. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/zmii.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index b0c46dfe95b5..40744733fd02 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -232,9 +232,7 @@ void *zmii_dump_regs(struct platform_device *ofdev, voi= d *buf) =20 static int zmii_probe(struct platform_device *ofdev) { - struct device_node *np =3D ofdev->dev.of_node; struct zmii_instance *dev; - struct resource regs; int err; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct zmii_instance), @@ -249,16 +247,10 @@ static int zmii_probe(struct platform_device *ofdev) dev->ofdev =3D ofdev; dev->mode =3D PHY_INTERFACE_MODE_NA; =20 - if (of_address_to_resource(np, 0, ®s)) { - printk(KERN_ERR "%pOF: Can't get registers address\n", np); - return -ENXIO; - } - - dev->base =3D (struct zmii_regs __iomem *)ioremap(regs.start, - sizeof(struct zmii_regs)); - if (!dev->base) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - return -ENOMEM; + dev->base =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->base)) { + dev_err(&ofdev->dev, "can't map device registers"); + return PTR_ERR(dev->base); } =20 /* We may need FER value for autodetection later */ @@ -274,15 +266,6 @@ static int zmii_probe(struct platform_device *ofdev) return 0; } =20 -static void zmii_remove(struct platform_device *ofdev) -{ - struct zmii_instance *dev =3D platform_get_drvdata(ofdev); - - WARN_ON(dev->users !=3D 0); - - iounmap(dev->base); -} - static const struct of_device_id zmii_match[] =3D { { @@ -301,7 +284,6 @@ static struct platform_driver zmii_driver =3D { .of_match_table =3D zmii_match, }, .probe =3D zmii_probe, - .remove_new =3D zmii_remove, }; =20 module_platform_driver(zmii_driver); --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D42F0178367; Sun, 6 Oct 2024 02:29:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181747; cv=none; b=X5qnVkg7oHzNfW3NUSUyINwFHutPrlYsaPBj6NC5MDnF4zff7bUycE1wTLXbnzn6H7AKoKtAfZk2v/MuZb1WE4jSZNdgB/7zBJaw6Ysz0+fa52a4k2SpXcP5RGxFXfBhvJ2YDR9/n4K6HlGcwpakKWZd9+ogZeFO2/6bPeqF+Bo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181747; c=relaxed/simple; bh=kih75HuZ1ZXc3JQHkzwuj//sPN9nSONeRe7im09vADU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d1MVt7ATJL7LMt2mPWeAuuILXjxZIxSw2Fl3FTXRiCFfJUSzgWLDM2hng5rAwKNxFpbiwd7rFZ28gk46jB4KyGvl5DKRu3Se8wpreQN0yvE5ixbHUPhC0oVUZU1g6p6fgVqYNM3OR08FoJ46fWhfDGPbSufYCm+MlLFqvOVzvKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hHWi+FxO; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hHWi+FxO" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-7d916b6a73aso1980973a12.1; Sat, 05 Oct 2024 19:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181741; x=1728786541; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RUV0cdXbjkkkderKYay9dxBu1U/jTzVeigZXhXzokHI=; b=hHWi+FxOWtRfgjMkMjVWnfIBPuzqfRt8sfcBaL5Yuw0l71a4XBSCfmFR0CnKmNFLqg /aG7y7ifTmplNP+AHAmhztDwtncn4W+Ga2uy14I6sUCLD23SUPzix+qdw5+6KAR3TjRl bEmiFvMwig6o6NCs9i0Hc+nCvsMfiRlCsQttFnRnEqYA6NCjiJGPfnCE4wbL25JUf+M2 rx3pn9gh0Skg2yoWOke+gLEP/9GGM5SvnuZnrtY8swwlsC630vxkTjQUh/vihBxWRWCA YA0wUzqtrfKQ5xKpY0Yyu0in6al1wSzCHV+9+J7k7mMwaKRXIzVnM0NpHq65hzGgK6hp ZZFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181741; x=1728786541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RUV0cdXbjkkkderKYay9dxBu1U/jTzVeigZXhXzokHI=; b=KsrTiaJyKnkJYbB8PB5RTxpN/k/loUD2eG4HqPnzjDeqYAO+/t23kCJadY5c/72BJQ i/IrK8v1lblJWgxteJa5X0+NeVkSy6qUx/CPcCFVSOKnM3c9bBXozktdc3/rAQ3HAzlo BPTfkzTRTwZV9f4GeysYy5XwUzZGwCjgrYkxyHr+Nos7onpo2egYPUu6Lmy9Wr7X21ef vdxoHoEeL268piwsJ9cLNzim8INc0BipLgWIxNjk4GZnusYKK+flRBvOAuqjLGlaxySz si+mpHpmn3z2BwsjjvSSasGTJMajIgsuba3YMyzPTdDveiOXenVbt6dRgEl1XkfWvbHO WjdQ== X-Forwarded-Encrypted: i=1; AJvYcCV3foyv5jQA3gXlZAHFAXHjmV1L4V604u3jfhpguWTxJNHqyfVg6J/Hzq3uYGzfqDw+gg2vnb3Z9wuAwpk=@vger.kernel.org X-Gm-Message-State: AOJu0YwKKtsTRZ9+KlPqmSzlDrp5ZevG/Y5wlo1MLtOHcufjvZkgtlTF 4ojinLkVLDBnv+Ay87QATGlP22vgyX1+BJSRy5DKT6r2kHluRwQdgaeuxw== X-Google-Smtp-Source: AGHT+IFPhKR7GQ4wNJbmoCs4peccILPfqn3lvDXQNeHck0E5mQFV8LUK8UUUYryb77T++LXf10K7tQ== X-Received: by 2002:a05:6a21:3318:b0:1cf:3838:1ed9 with SMTP id adf61e73a8af0-1d6dfae3320mr9240858637.50.1728181741141; Sat, 05 Oct 2024 19:29:01 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:29:00 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 10/14] net: ibm: emac: mal: use devm for kzalloc Date: Sat, 5 Oct 2024 19:28:40 -0700 Message-ID: <20241006022844.1041039-11-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index a632d3a207d3..70019ced47ff 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -524,7 +524,8 @@ static int mal_probe(struct platform_device *ofdev) unsigned long irqflags; irq_handler_t hdlr_serr, hdlr_txde, hdlr_rxde; =20 - mal =3D kzalloc(sizeof(struct mal_instance), GFP_KERNEL); + mal =3D devm_kzalloc(&ofdev->dev, sizeof(struct mal_instance), + GFP_KERNEL); if (!mal) return -ENOMEM; =20 @@ -539,8 +540,7 @@ static int mal_probe(struct platform_device *ofdev) printk(KERN_ERR "mal%d: can't find MAL num-tx-chans property!\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } mal->num_tx_chans =3D prop[0]; =20 @@ -549,8 +549,7 @@ static int mal_probe(struct platform_device *ofdev) printk(KERN_ERR "mal%d: can't find MAL num-rx-chans property!\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } mal->num_rx_chans =3D prop[0]; =20 @@ -558,15 +557,13 @@ static int mal_probe(struct platform_device *ofdev) if (dcr_base =3D=3D 0) { printk(KERN_ERR "mal%d: can't find DCR resource!\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } mal->dcr_host =3D dcr_map(ofdev->dev.of_node, dcr_base, 0x100); if (!DCR_MAP_OK(mal->dcr_host)) { printk(KERN_ERR "mal%d: failed to map DCRs !\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } =20 if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) { @@ -577,8 +574,7 @@ static int mal_probe(struct platform_device *ofdev) #else printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", ofdev->dev.of_node); - err =3D -ENODEV; - goto fail; + return -ENODEV; #endif } =20 @@ -711,9 +707,6 @@ static int mal_probe(struct platform_device *ofdev) free_netdev(mal->dummy_dev); fail_unmap: dcr_unmap(mal->dcr_host, 0x100); - fail: - kfree(mal); - return err; } =20 @@ -744,10 +737,9 @@ static void mal_remove(struct platform_device *ofdev) =20 dma_free_coherent(&ofdev->dev, sizeof(struct mal_descriptor) * - (NUM_TX_BUFF * mal->num_tx_chans + - NUM_RX_BUFF * mal->num_rx_chans), mal->bd_virt, - mal->bd_dma); - kfree(mal); + (NUM_TX_BUFF * mal->num_tx_chans + + NUM_RX_BUFF * mal->num_rx_chans), + mal->bd_virt, mal->bd_dma); } =20 static const struct of_device_id mal_platform_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D3FF17B400; Sun, 6 Oct 2024 02:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181744; cv=none; b=dS+8em442JkbGOcUjBloLwWOCNVerGWH8F6tKPdK3AqNzQSfvkvIEdxVltXC3sNI94QAy9nBu3qk03A9EoBmEEmVY690CNcHpzHkqeK3jLT3tOd9XgM3RO34RAmPGNRuyoJHyJ5h6A3asy7fqeEzE/A8FHjbjngX1iXefLQMLTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181744; c=relaxed/simple; bh=tPMaKKCrP3tEFhfNaUWKZ/JHAt5j/C2Ms8f8SpstWRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=foV9g1vOovyb2bBUpFX2iIEusYbaWWqDs6TnWf0U9CVktWK0guenFH3wx0bP4j5EgXTaXBmB81yWiIhauJaJlga0wIqwsL14fWEQgod6WXhnYZLTD9sj7sUlMFM+cTvg8QPPHO16AmTnNbdny2BpwizO0Taq7v4hT0yrs9616ok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kN1JrioP; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kN1JrioP" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71dfc1124cdso258706b3a.1; Sat, 05 Oct 2024 19:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181742; x=1728786542; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r2CvXoVohK/pulVhxC+r21/PlsTS5FXZz7L5qVXfWFU=; b=kN1JrioPgajEn6xS1KHQ9zM+XR6JKfmt8aABw0uuETjKYUeI5xb47GFV7HDBc+2Mn4 z/ZEOrIGFbgf1E81G1emZeqtpQliX0BIqzYGwiBWBXEIN/G7k11aQIiNykmLjT/Uwdo3 v7ET3Bx429jdQvSZsZKKOYKmiy0N9scOUluXrBEpFrR5eITBvci/6Mx8a/wfBdxUAgy/ dqLkP8ef9Bft3FE7p++jZ2DtR/iocwBzE7ytnE9inPN+MerIS+QcBSJYZyT6djaD9axN LiwhejrWjpl0REN3nuf1tIrl53NZN6Ir3ydW5KLHTfuVllLoKaDhvsebRJxodZBSJY7B S2Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181742; x=1728786542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r2CvXoVohK/pulVhxC+r21/PlsTS5FXZz7L5qVXfWFU=; b=XoandSTubV9/5Zbk+bqemu1S+SLPaKnWypfYZG9AjfDMai9NVsHS1weTlhASpDGEdY eC6xGv0ZguWNVVuqmQ94DcZBaoea/ZM1kNrkjmRdVT6bpUGQ1xoSBTRLc+yioSiimvwf lNhzQ2yCljkE7oaUyYyikdOJO9baRYPPzfvVTOs11AaqzNCnA/6njo5bm5nSuu3lz4jj Ov66LyJgLAI/TLUskxg+X33GegLocD4+ach5M2B1OiPRLaNcIEjguRlrZ0KnAcGTAXyT rLuIYZBhAlgZeydOQt8p0+HfYc903yjMQDrzlnwkrj/MQXP6ZoLG3DCaGcXKDfkwAwlr VVvQ== X-Forwarded-Encrypted: i=1; AJvYcCU1le9u/EAELiGtXeUttMV40XrUCTb+mvFhowMe7nj0NLg/EenQWfPa6xD1N3R0RAr5g4vpUOqhEpXrfQc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8f5Glt9UgIJb0j2DibYBh7fEU3auyDBsZ26195vZeHnAWl8jJ zq2Uw3I1NCX6HyMF4CI2at2XTXs6fi/cQ6U2BJEmhQcDpjJf3ITTeOHSQg== X-Google-Smtp-Source: AGHT+IHhcBDPHI6ZJiG4LrmxLbAs88LeuLCqJItCY+6yYrX51yIrGagTM9+9KDleQrCLiK9RVoC8XA== X-Received: by 2002:a05:6a00:914d:b0:71d:f2e1:f02b with SMTP id d2e1a72fcca58-71df2e1f068mr5495391b3a.2.1728181742525; Sat, 05 Oct 2024 19:29:02 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:29:02 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 11/14] net: ibm: emac: mal: use devm for request_irq Date: Sat, 5 Oct 2024 19:28:41 -0700 Message-ID: <20241006022844.1041039-12-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Avoids manual frees. Also replaced irq_of_parse_and_map with platform_get_irq since it's simpler and does the same thing. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 51 ++++++++++++----------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 70019ced47ff..b07b2e0ce478 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -578,19 +578,19 @@ static int mal_probe(struct platform_device *ofdev) #endif } =20 - mal->txeob_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 0); - mal->rxeob_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 1); - mal->serr_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 2); + mal->txeob_irq =3D platform_get_irq(ofdev, 0); + mal->rxeob_irq =3D platform_get_irq(ofdev, 1); + mal->serr_irq =3D platform_get_irq(ofdev, 2); =20 if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { mal->txde_irq =3D mal->rxde_irq =3D mal->serr_irq; } else { - mal->txde_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 3); - mal->rxde_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 4); + mal->txde_irq =3D platform_get_irq(ofdev, 3); + mal->rxde_irq =3D platform_get_irq(ofdev, 4); } =20 - if (!mal->txeob_irq || !mal->rxeob_irq || !mal->serr_irq || - !mal->txde_irq || !mal->rxde_irq) { + if (mal->txeob_irq < 0 || mal->rxeob_irq < 0 || mal->serr_irq < 0 || + mal->txde_irq < 0 || mal->rxde_irq < 0) { printk(KERN_ERR "mal%d: failed to map interrupts !\n", index); err =3D -ENODEV; @@ -660,21 +660,26 @@ static int mal_probe(struct platform_device *ofdev) hdlr_rxde =3D mal_rxde; } =20 - err =3D request_irq(mal->serr_irq, hdlr_serr, irqflags, "MAL SERR", mal); + err =3D devm_request_irq(&ofdev->dev, mal->serr_irq, hdlr_serr, irqflags, + "MAL SERR", mal); if (err) goto fail2; - err =3D request_irq(mal->txde_irq, hdlr_txde, irqflags, "MAL TX DE", mal); + err =3D devm_request_irq(&ofdev->dev, mal->txde_irq, hdlr_txde, irqflags, + "MAL TX DE", mal); if (err) - goto fail3; - err =3D request_irq(mal->txeob_irq, mal_txeob, 0, "MAL TX EOB", mal); + goto fail2; + err =3D devm_request_irq(&ofdev->dev, mal->txeob_irq, mal_txeob, 0, + "MAL TX EOB", mal); if (err) - goto fail4; - err =3D request_irq(mal->rxde_irq, hdlr_rxde, irqflags, "MAL RX DE", mal); + goto fail2; + err =3D devm_request_irq(&ofdev->dev, mal->rxde_irq, hdlr_rxde, irqflags, + "MAL RX DE", mal); if (err) - goto fail5; - err =3D request_irq(mal->rxeob_irq, mal_rxeob, 0, "MAL RX EOB", mal); + goto fail2; + err =3D devm_request_irq(&ofdev->dev, mal->rxeob_irq, mal_rxeob, 0, + "MAL RX EOB", mal); if (err) - goto fail6; + goto fail2; =20 /* Enable all MAL SERR interrupt sources */ set_mal_dcrn(mal, MAL_IER, MAL_IER_EVENTS); @@ -693,14 +698,6 @@ static int mal_probe(struct platform_device *ofdev) =20 return 0; =20 - fail6: - free_irq(mal->rxde_irq, mal); - fail5: - free_irq(mal->txeob_irq, mal); - fail4: - free_irq(mal->txde_irq, mal); - fail3: - free_irq(mal->serr_irq, mal); fail2: dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma); fail_dummy: @@ -725,12 +722,6 @@ static void mal_remove(struct platform_device *ofdev) "mal%d: commac list is not empty on remove!\n", mal->index); =20 - free_irq(mal->serr_irq, mal); - free_irq(mal->txde_irq, mal); - free_irq(mal->txeob_irq, mal); - free_irq(mal->rxde_irq, mal); - free_irq(mal->rxeob_irq, mal); - mal_reset(mal); =20 free_netdev(mal->dummy_dev); --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FD2217ADEE; Sun, 6 Oct 2024 02:29:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181750; cv=none; b=GbLtPoY4F2kQF9KyMB09LYlVc9LQgWb9r1A37RFS/L1BL3VyofuDow3wi3HUdmW7Ozo4CXZlvOC/3msm2D+0OL30mRW2whIyMsR664UykMEIy0h+Cjij0Rqgw2p+LcYL3FDj3drD90siJu+JuaWsfP4DeNzIVD37JTUntdONDOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181750; c=relaxed/simple; bh=eKiO/LEIBXXwlQ4KH7qVz+fyrkTR0L1Ipshtf4VGCgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UrcntI8YtfcwY0sLOfqeCU1HLxdft/Til9Lx0tFVghkYcH+KuxXaRGHvLHqn28R2rG3Z9OqcyC3RKW/1dnwojQCZmqGhlArl8AXeS+NNYZeD+oft8noLN7GWZz9A+fp5/m+J+xQA+fJ1a/kDiTnJwkMxQkO+27ByFkH1P7wzVNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CPHPPbGh; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CPHPPbGh" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7e9ff6fb4c6so813218a12.3; Sat, 05 Oct 2024 19:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181744; x=1728786544; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dq4R22bB9X5Y2tGuUBetWh4QBzSEUK/HudSJSZz34VU=; b=CPHPPbGhsZqpRyLC3uRvKeTBVAt9ma1gkPZtrf6spfrNpZc4m10cBKv7oY0ju/7XkC QfZChvGCGPdxNR4FPhyeGNPC9h+/fAsbS4HS5SavBi8qPJkhI+el2acI6yWOCsJfzcrq YIiMuHdiGS9Te7tU5fV0BFg5hjm+vJ+aNj6nAWQDYBiLr+VHARJPDwtXLedB3XGpzv4E xl3hnjuydwe7PLoDhwfNWs5QzmnjxdT5oQyvVdTXRead1WcqXC2RUyo9wo1VpyvjMS9t pnOLgT8FbrV8KP9rA5A3Q/YgdfwAi+YaxJG6HUyxL+kg45uakhdVmAxtRNd1V1XvHt9I XS+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181744; x=1728786544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dq4R22bB9X5Y2tGuUBetWh4QBzSEUK/HudSJSZz34VU=; b=DNadMo93YRE/iqhc01J0ee2Cvqp4vAwvVciu4eAY+DghdOwJZD8HrS21AJ/KdnaKXN De8xI945kjuVy9s9NAVLflNbV9wQFSVEB/icSMG16OnpLEoWzew47p2WejTvejjwnqpU 7huWY04euFcREM3yDcC3tlvgw26vX+1ZXCCLDFRta0zLGicCFwPZMrCohAE1QyKnsvuv I8F4HGtA4AwUjPa6dcmY8mD/Dz5HQ+ATiDPNap8t3U17mMQyl9OBHGyJkLaQ2eW9stdi 3lByOXlXFSrmcbhEYFGYgg2PEmgnQM708mULUezqk/XVQtsoerPgk7DKM2mP9468gIOI gtTg== X-Forwarded-Encrypted: i=1; AJvYcCUiaVZItzDzHHhjO8/td7KeQii9m9NoCux1BCrDzQNtCUL/D18tJn1QCJurj7mNGNzVG4PM/t+c5p4j4Bw=@vger.kernel.org X-Gm-Message-State: AOJu0YycRqmrnWiJ1fwAlqBHSypQyzjMmvsLUBQTzCWpKFoY+vP+zPBz /8NtxVb2M5m00gQeV4CL0hsHITofRqIhAP7s9reTN74KBL8j2M5voUkvVg== X-Google-Smtp-Source: AGHT+IHW3pdoO8XP4rbV/wB6frVIzxNVvG3SLixBgS5he01rdeXVTckME/MXmCnJJ5Oy8oqpJKkG0A== X-Received: by 2002:a05:6a21:9187:b0:1d3:eb6:c79b with SMTP id adf61e73a8af0-1d6dfa231cfmr14360117637.9.1728181744411; Sat, 05 Oct 2024 19:29:04 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:29:04 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 12/14] net: ibm: emac: mal: move irq maps down Date: Sat, 5 Oct 2024 19:28:42 -0700 Message-ID: <20241006022844.1041039-13-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Moves the handling right before they are used and allows merging a branch. Also get rid of the error handling as devm_request_irq can handle that. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index b07b2e0ce478..3fae1f0ec020 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -578,25 +578,6 @@ static int mal_probe(struct platform_device *ofdev) #endif } =20 - mal->txeob_irq =3D platform_get_irq(ofdev, 0); - mal->rxeob_irq =3D platform_get_irq(ofdev, 1); - mal->serr_irq =3D platform_get_irq(ofdev, 2); - - if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { - mal->txde_irq =3D mal->rxde_irq =3D mal->serr_irq; - } else { - mal->txde_irq =3D platform_get_irq(ofdev, 3); - mal->rxde_irq =3D platform_get_irq(ofdev, 4); - } - - if (mal->txeob_irq < 0 || mal->rxeob_irq < 0 || mal->serr_irq < 0 || - mal->txde_irq < 0 || mal->rxde_irq < 0) { - printk(KERN_ERR - "mal%d: failed to map interrupts !\n", index); - err =3D -ENODEV; - goto fail_unmap; - } - INIT_LIST_HEAD(&mal->poll_list); INIT_LIST_HEAD(&mal->list); spin_lock_init(&mal->lock); @@ -650,10 +631,17 @@ static int mal_probe(struct platform_device *ofdev) sizeof(struct mal_descriptor) * mal_rx_bd_offset(mal, i)); =20 + mal->txeob_irq =3D platform_get_irq(ofdev, 0); + mal->rxeob_irq =3D platform_get_irq(ofdev, 1); + mal->serr_irq =3D platform_get_irq(ofdev, 2); + if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { + mal->txde_irq =3D mal->rxde_irq =3D mal->serr_irq; irqflags =3D IRQF_SHARED; hdlr_serr =3D hdlr_txde =3D hdlr_rxde =3D mal_int; } else { + mal->txde_irq =3D platform_get_irq(ofdev, 3); + mal->rxde_irq =3D platform_get_irq(ofdev, 4); irqflags =3D 0; hdlr_serr =3D mal_serr; hdlr_txde =3D mal_txde; --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9ECC17BECC; Sun, 6 Oct 2024 02:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181748; cv=none; b=JPFX/rpWf8SvdiTOFis1eommtpzR72V7ZTNzwKHhT2OqiU8GtPQuh8/Z/1TqVbfdEvj3nNdS5o80I0eDbTU3LxZtNpcyMwbEb6dsC/0lqMcR5Qn2Ywi7NqS0pgTVjecC8jp7PM+dAqIGFiQVIXoo/Yp7K4Jrz0bpych4fovcces= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181748; c=relaxed/simple; bh=3znYEdrKrSJmBz47ry+O584EposhcMqI2RWTfyP9gqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LZzq8NdGiutoDUx9I8cuPTtjQBCTtY1znLOXgQtodOSGX8RnqXI0mQaQd7tKJX3s3KdfwZ4eT7Yt/2jB+YvEkMAhMYsc5nsdlUPxenVq+ocWTHLWGv9SuZeqIP/r5rg7x0n03/XK+d7C7g/IT4/GfZ8l42xMcIqPiqL5WX0pFc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bRKBgVuT; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bRKBgVuT" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-7179069d029so2540873b3a.2; Sat, 05 Oct 2024 19:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181746; x=1728786546; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4i5ri64hrjVdmz3tZTzX5i7c0GV7hJBF3q4OdGMq8f8=; b=bRKBgVuTnRdlpgrsJ45AyCP9ZAqjGtSEmo73t7X0Z75sILxBd1nmTfG8FEslAFBZIs kSVywBhvWnc8ruTq3u1QOtByDkD7xBr/4nTSiESlQysj4lDju4r1F4PKEqBLLF009/Dj UjPykaViApdyHRL/JbpbqNflL2yjrUAEdmPJh/bEjGqbkpfAX3XjM1tqJMMu8dsDKIJM 6nFA8fz5npekQyeTqyW0XfBuyFbuQE1WvGZrhYcHKOjriJTK0v+WnI09nSLH8G8v25HG JJbkLBSinTa2IVrYOzLVwZpjiVyerCSUY2fcBLSmPHdlP8vAipYoz/cgHYA+JT4dNC2g 51hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181746; x=1728786546; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4i5ri64hrjVdmz3tZTzX5i7c0GV7hJBF3q4OdGMq8f8=; b=BHz6W/JfE5v8j9u8xX/VXrep9mNobuXSzfjxyjVEQ2cEJl9CbBeTbV9BW8OwdDBleE Mg73433RNlTWvc/p+CYlODoV52gFltuY8OBz9U3yOaBsRtaDoWNO8Cwx3/seEKAUfXjT uyxTwu/BCZ90+JotDa6RxJKkGMT8NBS7OL/MyZd8HgBmsPoIBDnPIMuAxJW0N/GBU9+o vNag7/wXbXQ6Yne7mxC8hoH8QlT2zMkVLGAyZTmrLTbqkFQGNxq1BJTheP5tAZeYAX2K bkshtxsLzKB8prCzjSySnKEB/5P+fx+12DeEBSC5LbluBZ0VR+NOPDFLCSBxGoAKroON iBaw== X-Forwarded-Encrypted: i=1; AJvYcCXSYD/tYevHyowj4C09qYmkNirvXeLOtVj5Z9qbIwdDL/RDYzEK2Y1+3LOZPpz8dpRBdc9qf4mOeZLEI+w=@vger.kernel.org X-Gm-Message-State: AOJu0YzuQ6YkmuCT+cC6hYF+asn5FOnqLP+7Np/ME+JXHPa70cCVjAzk lgIWCI6sM5qMsBbwhPhCPSs9bAmpj2KUGcHBlwB6Jca30eGr6Aa36nrHLA== X-Google-Smtp-Source: AGHT+IFzm88Fa94rK6hTif0Vk6/kRiFoep8XMF9N5/+XAueLMSgYWskYCtoPaNxR/tfr9rjeTXx5zQ== X-Received: by 2002:a05:6a21:2d8a:b0:1d4:becc:6ef1 with SMTP id adf61e73a8af0-1d6dfac9a42mr11214247637.31.1728181745928; Sat, 05 Oct 2024 19:29:05 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:29:05 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 13/14] net: ibm: emac: mal: add dcr_unmap to _remove Date: Sat, 5 Oct 2024 19:28:43 -0700 Message-ID: <20241006022844.1041039-14-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It's done in probe so it should be done here. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 3fae1f0ec020..4f58a38f4b32 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -714,6 +714,8 @@ static void mal_remove(struct platform_device *ofdev) =20 free_netdev(mal->dummy_dev); =20 + dcr_unmap(mal->dcr_host, 0x100); + dma_free_coherent(&ofdev->dev, sizeof(struct mal_descriptor) * (NUM_TX_BUFF * mal->num_tx_chans + --=20 2.46.2 From nobody Thu Nov 28 00:40:56 2024 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BECD17C9BA; Sun, 6 Oct 2024 02:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181750; cv=none; b=iE/u4nFW1bqL4eYIgU1tt/WmmpS6ZAAPXzpazg02M4nD3O5FNNK0ruMLMIXyISdrbRtMCD930lmGcwo6MycvOiD8L/VmieszlJSmXK1GY/OxIzs/d4BSXwQFcx7Pwn0lVqFk04vmdSUPo+T5khe2xUHmAGMLM83R1A7PA/MmSno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728181750; c=relaxed/simple; bh=xkMQUJ+a/seJ+Y5YjIAKxVPqeaNfl7Neu2vo2r4t7VA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rWu0pZtl2yZb6ePrlndxIeREhFtuljFJIg8/jJmHSvD25eAPmioZyacE9KGtPJfWXzKJ5XpRranJ0caY8NTZtg+sDIoZiSfcmeu2TRMMT0ucgsD7RY9BTOczTHrM3va/A3G9+uu6xnZ49xJPg2p6jUQI0wWPDv21i9+gAoNGiUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hAEACb6p; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hAEACb6p" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71dea49e808so1536445b3a.1; Sat, 05 Oct 2024 19:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728181748; x=1728786548; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6KWs0i5ENfOJtknzBiWTETb7i51VBhlSos8aop6cLiw=; b=hAEACb6p3wbx6N9CcunzPDsaM2x5TTzT7hEe4j3IqH++IYZlSPcV6eP+Iq5683/0pJ Q7ccZ+heggQru4QAyByOJ0KS6nGCAlOKDC/Tpr9uMsOnPnMlPjgyZslbPT+wMGRrhv2i IUIypQhLI5db++Q/odzd6Wp2XuunMYCfvnerBTck79mvsE1gsOLRP/5YetUnaULe3XfV gySor7oNKAqZ1FTNNARTIOSRDFk8UmRgs/Q5T7rPSPiR092OYINmWwO4pCJl5j4zQ/Wr CPGe+kfcTipccQ/6wcrr0glcPI75EgUf8alGaHQmXdeS0Rh1b9v965OFqImkev8h4D0I dOQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728181748; x=1728786548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6KWs0i5ENfOJtknzBiWTETb7i51VBhlSos8aop6cLiw=; b=hkBGbGvZeaYcNaCO8qQTNrQpdLMjucYbcxPxh/PLkKgi1ZphimIWcUU1oaMXIVZYbX UXLy9yOEJOPoEd1OIYMDiFvJ3X72gylGVpCLIy3mDyd7ZDGfgmifEQGGnw6mN7OKmxVx 7VQj5ZeSV5BKSkJ1gFk/T5ovqyzjKCaUQgfD1nfjXmXjyMFBg7YlDV6umzvMTFTZ3qjA vCNnrbeZIsHkBFFs7MGW17sNS3cUxf8RQ9jfgYyWpFsT91BjF+EA6VmKV0P/HDY65Swr 7VIWyTCeNs+eS4rktwL6Vw5nz1besWj7h1yusrRcd5mV5KAkfTCT1sKhjDE6SjuXWMYC ihMA== X-Forwarded-Encrypted: i=1; AJvYcCXHNdzsL5v/fO11wBB5n5Kvk1ZnQDPfUYr7pNq5tW/UUqlLIpwN/8yuzQyZpRmGlYR2Y1D2SBpOqmRz084=@vger.kernel.org X-Gm-Message-State: AOJu0YxnvHOyQn/hnozv4HxS1xudv4O3P1U4QpKRd9bNrsevGumM9PN3 cPm+OLdgqzEYRcYfzfUeim1bucK+t8ulnAsgK5DHpQY4CjUOCyn6cZDNMw== X-Google-Smtp-Source: AGHT+IEvmSdDdZF870VA1Mm/Ta9tCFiOKOs1rkOxDioNknv6DcvQtKxwQ+yoE3VfC9AU1hqVk/n3vw== X-Received: by 2002:a05:6a00:190a:b0:706:74be:686e with SMTP id d2e1a72fcca58-71de2474d77mr12085555b3a.26.1728181747820; Sat, 05 Oct 2024 19:29:07 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbb9bcsm2103550b3a.6.2024.10.05.19.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:29:07 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 14/14] net: ibm: emac: mal: move dcr map down Date: Sat, 5 Oct 2024 19:28:44 -0700 Message-ID: <20241006022844.1041039-15-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006022844.1041039-1-rosenp@gmail.com> References: <20241006022844.1041039-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There's actually a bug above where it returns instead of calling goto. Instead of calling goto, move dcr_map and friends down as they're used right after the spinlock in mal_reset. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 4f58a38f4b32..e6354843d856 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -553,6 +553,18 @@ static int mal_probe(struct platform_device *ofdev) } mal->num_rx_chans =3D prop[0]; =20 + if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) { +#if defined(CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT) && \ + defined(CONFIG_IBM_EMAC_MAL_COMMON_ERR) + mal->features |=3D (MAL_FTR_CLEAR_ICINTSTAT | + MAL_FTR_COMMON_ERR_INT); +#else + printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", + ofdev->dev.of_node); + return -ENODEV; +#endif + } + dcr_base =3D dcr_resource_start(ofdev->dev.of_node, 0); if (dcr_base =3D=3D 0) { printk(KERN_ERR @@ -566,18 +578,6 @@ static int mal_probe(struct platform_device *ofdev) return -ENODEV; } =20 - if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) { -#if defined(CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT) && \ - defined(CONFIG_IBM_EMAC_MAL_COMMON_ERR) - mal->features |=3D (MAL_FTR_CLEAR_ICINTSTAT | - MAL_FTR_COMMON_ERR_INT); -#else - printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", - ofdev->dev.of_node); - return -ENODEV; -#endif - } - INIT_LIST_HEAD(&mal->poll_list); INIT_LIST_HEAD(&mal->list); spin_lock_init(&mal->lock); --=20 2.46.2