From nobody Mon Feb 9 12:27:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE42C83F01 for ; Wed, 30 Aug 2023 22:43:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344100AbjH3Wnd (ORCPT ); Wed, 30 Aug 2023 18:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343986AbjH3Wnc (ORCPT ); Wed, 30 Aug 2023 18:43:32 -0400 Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E009CF4 for ; Wed, 30 Aug 2023 15:43:09 -0700 (PDT) Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4Rbd324qxyzMG; Wed, 30 Aug 2023 23:38:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1693431534; bh=hUkNLtMYrhMoAqr2vDdOq6o7qYhnoFkBKelx/varQcs=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=Lz6i3AeoqQZg02m5C9/bBSS1UCL3wLwsUk57j7sZ8UtFeVfUiHI+D+zXcIsjzowv5 fE+wSEaXQmX6FyFOwX5uhWqm6ZNIf9D+Tl1Lqf5iukQkYRRdA2jkCAIHEACxFnxLzi WgRth3bJFj+Hr2aRbcMrGYbLRb6VBidgm1cyfIVzJaJolKIbZjSHYgjvmseyj3ADBH X6hLcdC7DDcOK9dMGYiW9A+QpR3tAOW7jE2PX9mnwqlL13l78ySEWl9wixi3ICM9N5 pQDouJnrgQ3px8LULtXIXZnKwgScLRwUo8bULy/9GyZQjBzihGfsDfJ7KR+0JT9nRC 0NTwlJQFzBbkg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at mail Date: Wed, 30 Aug 2023 23:38:54 +0200 Message-Id: In-Reply-To: References: Subject: [PATCH 1/9] regulator/core: _regulator_get: simplify error returns MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove unnecessary stores to `regulator`. Signed-off-by: Micha=C5=82 Miros=C5=82aw --- drivers/regulator/core.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 662711063433..d440cd137c38 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2209,15 +2209,13 @@ struct regulator *_regulator_get(struct device *dev= , const char *id, } =20 if (rdev->exclusive) { - regulator =3D ERR_PTR(-EPERM); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EPERM); } =20 if (get_type =3D=3D EXCLUSIVE_GET && rdev->open_count) { - regulator =3D ERR_PTR(-EBUSY); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EBUSY); } =20 mutex_lock(®ulator_list_mutex); @@ -2225,32 +2223,28 @@ struct regulator *_regulator_get(struct device *dev= , const char *id, mutex_unlock(®ulator_list_mutex); =20 if (ret !=3D 0) { - regulator =3D ERR_PTR(-EPROBE_DEFER); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EPROBE_DEFER); } =20 ret =3D regulator_resolve_supply(rdev); if (ret < 0) { - regulator =3D ERR_PTR(ret); put_device(&rdev->dev); - return regulator; + return ERR_PTR(ret); } =20 if (!try_module_get(rdev->owner)) { - regulator =3D ERR_PTR(-EPROBE_DEFER); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EPROBE_DEFER); } =20 regulator_lock(rdev); regulator =3D create_regulator(rdev, dev, id); regulator_unlock(rdev); if (regulator =3D=3D NULL) { - regulator =3D ERR_PTR(-ENOMEM); module_put(rdev->owner); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-ENOMEM); } =20 rdev->open_count++; --=20 2.39.2