Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1908161rbb; Tue, 27 Feb 2024 05:15:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHV4MfOURCh5OkhVEO+VYx2ryGZmt43Qu1tPX6Ubmd98kpA3KfTO1BRegtKp9KaSgEg1uJ1g/wrKsCn4yT7xCvgSmhtK56jkgVc0rqWw== X-Google-Smtp-Source: AGHT+IFqJ+tiLAPnI1TyWQLJm7lq0kMJIbtbKuzihF7lTtHMlJ1jgRx1fcuD8gZCvUKonrY4vtO7 X-Received: by 2002:aa7:cf18:0:b0:565:59a:a103 with SMTP id a24-20020aa7cf18000000b00565059aa103mr6176919edy.33.1709039751838; Tue, 27 Feb 2024 05:15:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709039751; cv=pass; d=google.com; s=arc-20160816; b=v6n5AWOcmloUbt8JcTxt+1PQJxgC0ifLo4uL8XXWLsaNzQ/8bIrjFnK/i7VeEYoU9z Dpw2XN3NxEzo+oJM36LP7lpA+Rahzo8mbgMiud/1kvbOKV0ufoUYna8eGY9QPqpnM6BT uyb6d7d9tG/czUGSsbGxD/UBSQh8preC3jdErsZd1gfffgJrKgwZ9Rq1AqivciX4NUXM 8rqWVSj4Uo+3PvnOFsBZbYvIoc39JOjcn3WIrzWc8maryzrCamzoRINWh0fHfKv6fEPY bS0KHoW0NN+6+N1Leg0a5lNSIBk0qADsFhQY6ozPun3C2DX6oThZtbajvZqFB8AYD+g2 ZUwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:subject:from:cc :content-language:to:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=KV5RjX4MA+WofFzZs19kwhj3xKMuC5v582/o8UWpIX8=; fh=lhha7NUm5W2CWwhc5OcPp/4DgG5Wqc/MpP4CUB3bvD4=; b=ld3iEJun52HJboe+QVA87l5frptKbfgt4rsKoI9it2FG1iNm956sMwcX8EiKMqT8Ms iM6aDUnHfCraGCGdH+N7IjC95deHov6rmhJN0mWvIQqFOh+61ZlrtKpYeeGpX/IQxZE8 WWvlzdBtH4a2xcQdEA2BaV3ZGrpFJz2+UCpgnJUmEasVuQUo2zLhU7Gih8St6Sj9Zo4Z wKbcRIhznjOb8mzNVWjKdYIuZLarSOHjUlO3+nxX4vgr0JTlW4HvdejhV8BIa+5XSgSN YR8k4CXCZVXBDp/5/qjfCf8kQi/gCTlqqknoAAPpfv3yt1ASnpm58PcCY68yhhgt0bwf nn5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b="f2BOj/wU"; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-83298-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f26-20020a056402161a00b00564bcb145fdsi686469edv.11.2024.02.27.05.15.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:15:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83298-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b="f2BOj/wU"; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-83298-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9563B1F27104 for ; Tue, 27 Feb 2024 13:15:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D066713B78F; Tue, 27 Feb 2024 13:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="f2BOj/wU" Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93EC213AA47; Tue, 27 Feb 2024 13:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709039719; cv=none; b=cahpikHUVSx9ancYIW5eczor9e9giXd/Gln34E1uJmbEjU1wUYXtKobVMCZ91+8JtcCdXcWTANtdqlPrXGtsbjnnIZid/jIZVsc0oFxfjvXr7YtBy8/lY8ddtHqEVfsx4eRTXoAj1Aiv1gmfQ55ON18uWLpnnCdMvKf+nLKbx0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709039719; c=relaxed/simple; bh=FBp4MDnDC75gzPDqxDP5QxL3po+9KLgHyEoDNJ8jPX0=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=jHTQSExsQIPmLOYxRt/3bC/sjdMdHcmyI3y1Za+x6lkq2/DqomLfgUoHrSKzx3hNVWRGZfV7oowfjBr6ScAk6LyEvACUGmKMYLWBFnDz44ekozwosdjkODyGuIs5uAHBZ3SEd5ICq1jrLrFM8YN5KhOT49IY7LkPynBaBu0pIgY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=f2BOj/wU; arc=none smtp.client-ip=212.227.15.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1709039695; x=1709644495; i=markus.elfring@web.de; bh=FBp4MDnDC75gzPDqxDP5QxL3po+9KLgHyEoDNJ8jPX0=; h=X-UI-Sender-Class:Date:To:Cc:From:Subject; b=f2BOj/wUphPDnXxiqUYksZagtn/Jd4Md3BUDukbzbBpXnewv7EXlSUwIOcDVWVHj o63Gvz8DdKEttH1lIaNayIfJuVsTzfPjhUMGmraJQP3pkGj5q81mfpHR8lqKhElK6 OUh+RJ5jM+3Al/Vx7dnmvXkR3L2hEDlPtmoCmrviEvCYXdBDRdG4lmZbZe53dPZX+ b/jRZSLs/6QpI3TALw1WCO3XpiaQpoBDTmf4/35YCUg52T43Nm/OLN9z0EcGALe9M ZbJsgc/4hce7WDjQ/VCCIaRnP7XHHixMOrRh/BHE8rfEgyyn2Spuvq3JtE6GvcVC+ L4xg8PQT6pVfEBPy3Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.82.95]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MActo-1rlWsR2EKe-00B2xL; Tue, 27 Feb 2024 14:14:55 +0100 Message-ID: <9b879c8d-4c28-4748-acf6-18dc69d8ebdf@web.de> Date: Tue, 27 Feb 2024 14:14:52 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Madalin Bucur , Paolo Abeni , Sean Anderson Content-Language: en-GB Cc: LKML From: Markus Elfring Subject: [PATCH] net: fman: Use common error handling code in dtsec_init() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:uZyZ7wALjwGCm5kyUSIblzVfyzZ0lkUpsX745gNqt2IL/1JyiYR xKuLS5MHaSaWBKS5JZzmnUt9nZRkdLJiSywPZmJfNLYBmnrhaCuhtYmFUoZoxXbGEUOVVVd DT559PhNXUd6W0NwQFRSIkFLTQSM9tNxZlZAg0r6NoZzwBFjSlnO5QTdtUGkrzHcfIVEfI3 X2Xd6wpKL7tasXzjcVdlQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:MMHx4LFE7is=;DRqgI+61KeO1S7erGzNs44kiDPH VSaTx1zQSD+TWBMa5N3SsnNGpa5Qc+y2x0ZpyHgVo7m0y8hGVom5ru3EWVbXBSYZy02geUb82 jpGIU+9p22o/I0LK6wvbnrk9xozleo9fLQEVJL+pYkIBkTRHPAE5XlCCtGni1hwdty1QQ+5sU kvQX22u9K7s5exwL9rjExyG5F3tD/lL6+rGyOgW4usuN92L4Ss8aGjEhEKY/+B8uy7Zm7cT1d UJl+sAOwn63nWxB+x1WNk/MLRgrQ8uArapuVbZu4dBhJe9tfNdHbJDyqFIkFQSO31cgTfsLUS 7ib0etfM7SK+TesulpXykuqzEXexgXkVc3IjlPBom6h+RoiS/GaCLxaL+vLENRD97G+DuVea0 d54qKE79zpKM3BcQmSUxVL6CZ+jZGZi43pVJNZe1oUSwpuleK7fiHDTkn7pBuZav/x8BYq42x ObHmBUyEj+v0Nk7cyqmvHRkDV4CHO6c1kq2ishjXOMcM19HGud+BrJVGCrHmNBmRbwsPbDYRp B3nYWOyyrsZ7TGqoIc7IXe0d3u8KUTzk0HtW0N9Y5oNrXYfnjhV9clC5FWtvQsAJWfZ2O8vFC fgsMxjJDudnUI3gyPhbwdRZ+duDbDCoXMlzWkIkoX0ixazNo1UP+hwNCHr/VhLeG9Oir342Fo cATnqlDl25tXRPtKN/Z1tkNoE091WZKOZVxNWRNlFoCw+7Xhg9UTPDM4RgNJqy/uaw2moET1w //asaFl7VGJjuSaqI2fOjYctRT0LXkk/il1+A0GqWc73/pjma0FO1bH1kY3YnPijgGaO4Vlr3 gZqTjxAlgGsyqNlEnK1sxN4Jp21vJKwiT9OWmXlWLPSrI= From: Markus Elfring Date: Tue, 27 Feb 2024 14:05:25 +0100 Adjust jump targets so that a bit of exception handling can be better reused at the end of this function implementation. Signed-off-by: Markus Elfring =2D-- .../net/ethernet/freescale/fman/fman_dtsec.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/ne= t/ethernet/freescale/fman/fman_dtsec.c index 3088da7adf0f..1de22400fd89 100644 =2D-- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1279,9 +1279,8 @@ static int dtsec_init(struct fman_mac *dtsec) dtsec->max_speed, dtsec->addr, dtsec->exceptions, dtsec->tbidev->addr); if (err) { - free_init_resources(dtsec); pr_err("DTSEC version doesn't support this i/f mode\n"); - return err; + goto free_resources; } /* Configure the TBI PHY Control Register */ @@ -1296,23 +1295,21 @@ static int dtsec_init(struct fman_mac *dtsec) err =3D fman_set_mac_max_frame(dtsec->fm, dtsec->mac_id, max_frm_ln); if (err) { pr_err("Setting max frame length failed\n"); - free_init_resources(dtsec); - return -EINVAL; + err =3D -EINVAL; + goto free_resources; } dtsec->multicast_addr_hash =3D alloc_hash_table(EXTENDED_HASH_TABLE_SIZE); if (!dtsec->multicast_addr_hash) { - free_init_resources(dtsec); pr_err("MC hash table is failed\n"); - return -ENOMEM; + goto e_nomem; } dtsec->unicast_addr_hash =3D alloc_hash_table(DTSEC_HASH_TABLE_SIZE); if (!dtsec->unicast_addr_hash) { - free_init_resources(dtsec); pr_err("UC hash table is failed\n"); - return -ENOMEM; + goto e_nomem; } /* register err intr handler for dtsec to FPM (err) */ @@ -1326,6 +1323,12 @@ static int dtsec_init(struct fman_mac *dtsec) dtsec->dtsec_drv_param =3D NULL; return 0; + +e_nomem: + err =3D -ENOMEM; +free_resources: + free_init_resources(dtsec); + return err; } static int dtsec_free(struct fman_mac *dtsec) =2D- 2.43.2