Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1415231lqa; Mon, 29 Apr 2024 07:57:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmtEb17AHgQdX3qM5HK2+XEsbKs+FtPSPWNyOEPgNiVD5U2idC6oswy2ysOSjMv3+kpOFFZvfnzmEleFcdi6ryATm2xRuK5xxDSOLEeA== X-Google-Smtp-Source: AGHT+IFo7DtJCU08y4IlnrJXp0EVcEi9COBtKHwUsgtb4FBy2ZVC/M51GFgHxCkw4qlf7/m3nQLO X-Received: by 2002:a05:6870:2043:b0:229:f022:ef83 with SMTP id l3-20020a056870204300b00229f022ef83mr14066018oad.43.1714402620376; Mon, 29 Apr 2024 07:57:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714402620; cv=pass; d=google.com; s=arc-20160816; b=hYtUZ4ANwe2jhoME0BWEtiHv62GHkdwibHhqv/fsPf1kx5Njk5axdNh+kQYc5cBrug hncgnml7PcHdRFr8gLXtx7K72+GvtrlKbAKzDla2uO2B1RSDn3gAThvyPqFlKSpt7l43 avTRVOm8MkQZGPVGbtu831IsgmhsNS0T3OJc+7Qx5C2mpPln13nJ6/JjKV+WQyHttTJI 2wdxGv+plQl9VmxieU83hf6WH2mqC21WUFR9bFgf4K2h08Vp/xdZxaSgdPDv1LAnY2LL f/+nDAITRI0JxOoySxLX2uKb8XsOHD5Gv5gEHkT37OGvKCPLX8cKXBv7dpcM7GFGTvAs 6ABQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:dkim-signature; bh=wWhfTzTQpuj/15hcMPKxYY5bB+Ohfq89jNhj3e4hLEA=; fh=9+JPiKUqmiwg7nrgynbn+qu8x0UhUJwyp0gAHVwwYQs=; b=Xg6tNe+5YXdaQsYD2fxlf++D8jGKOEvEkoC4LLxSYDVRVl0Mj0AkiBKgU8nGeGUR4H Rwl2WBX5q9Mn5IUxbtss3gkf3EWQk6eYLll+p1OALG4wiuf1UhECqRAf5EygJBbFTaT0 oZ/s5YiMopEEVhSKWa+iFPq49kZ24LLmFNqVNovJsst+FIPQc0tjg8jcQxRtiPuHXrfN 4aiWfE3Wt6HTUI59YJhOBBsVutdFlwTo9IdFuc0OpakikTm10Mhx39i9Pwb5LHuca9xH 5IoC+62JEPxBlGqDjaEX5ZqB3P9aNWFwRsfeQA2saonX1mhJ9is8C1T2jUIiezanxqnG LvaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b="R/pc/Wc+"; arc=pass (i=1 spf=pass spfdomain=rere.qmqm.pl dkim=pass dkdomain=rere.qmqm.pl dmarc=pass fromdomain=rere.qmqm.pl); spf=pass (google.com: domain of linux-kernel+bounces-162490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pj41-20020a05620a1da900b0078f066ae1c8si25047838qkn.470.2024.04.29.07.57.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 07:57:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b="R/pc/Wc+"; arc=pass (i=1 spf=pass spfdomain=rere.qmqm.pl dkim=pass dkdomain=rere.qmqm.pl dmarc=pass fromdomain=rere.qmqm.pl); spf=pass (google.com: domain of linux-kernel+bounces-162490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8CC1A1C21954 for ; Mon, 29 Apr 2024 14:51:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FFB881751; Mon, 29 Apr 2024 14:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="R/pc/Wc+" Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) (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 9044C7EF1C for ; Mon, 29 Apr 2024 14:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.227.64.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714402259; cv=none; b=W2vQuuUgYmv1IwuDTXczFpWDBXCfnYl9U4V3MR6sWNKgLooCZCvFYFLu16R0/9GNAju+LqIVGYZWShQhAsQFEqOnAydh6eaNEHk50rndvZO1PuqlAS1+EHek8/tWo3QSQ0yC1+7jtw+axlspVvC71ppafmZGDWt/FXfgcVywN0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714402259; c=relaxed/simple; bh=ta4hw3RJe3RLJyhrYAahLj+IfUyV8pprABjjd5hupD0=; h=Date:Message-Id:In-Reply-To:References:Subject:MIME-Version: Content-Type:From:To:Cc; b=GABZahlPAEaa3vmEKbZtTUovMqD6IkAAg/Pcgc3JzUgT6CkvF587c2sbp3Ktw+rsX00MA4Wb2blT7H9+ag1p1/96cb+o8fcS0Ykw5iQRzFa6qHxvmh+Vx/jI0f1GWeeEHHc3XC/cEtVZV/v2Z8g6qyeHhc49xzVZJtV3RdTroNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rere.qmqm.pl; spf=pass smtp.mailfrom=rere.qmqm.pl; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b=R/pc/Wc+; arc=none smtp.client-ip=91.227.64.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rere.qmqm.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rere.qmqm.pl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1714401927; bh=ta4hw3RJe3RLJyhrYAahLj+IfUyV8pprABjjd5hupD0=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=R/pc/Wc+3xgD24HE1IGkzNHeLQarLD6Dsr3hEkxHFYqDW0dM7fd29VYL3Xk0IfEVq u8XdiNBTA9LNRyymrwKSZyRqlGMGKcbARbrTK3kv7tda+NKtoixGcVBQ8IFIbq5+Ev nmuyOBTf0RtDfIvmbj3tIC7YyCRPrUOmeUu9HIyGhP0U0W4sFyKGyNiz13VGTg/54H O23z1nsQ6zTkGuTTA4wJmJbwTVjMk0tkFu1fjNOf/bxuHSdR8v0hhWy1AgAbhQc/Fo DH32ieTI2bMg20Fsv7oUyMDx323yUmA/ehB11iBhIwjjtOOhr92k7NKcYqFhioVXYB wv2jIrtEb36Mg== Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4VSmMq5ftlz8k; Mon, 29 Apr 2024 16:45:27 +0200 (CEST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 1.0.5 at mail Date: Mon, 29 Apr 2024 16:45:27 +0200 Message-Id: <2680c3b712b36a3ddc279b7efcd87dbf2f24ccaf.1714399603.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: Subject: [PATCH v2 01/12] regulator/core: _regulator_get: simplify error returns Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org Remove unnecessary stores to `regulator`. Signed-off-by: Michał Mirosław --- 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 dabac9772741..62dd3ac19e6d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2222,15 +2222,13 @@ struct regulator *_regulator_get(struct device *dev, const char *id, } if (rdev->exclusive) { - regulator = ERR_PTR(-EPERM); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EPERM); } if (get_type == EXCLUSIVE_GET && rdev->open_count) { - regulator = ERR_PTR(-EBUSY); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EBUSY); } mutex_lock(®ulator_list_mutex); @@ -2238,32 +2236,28 @@ struct regulator *_regulator_get(struct device *dev, const char *id, mutex_unlock(®ulator_list_mutex); if (ret != 0) { - regulator = ERR_PTR(-EPROBE_DEFER); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EPROBE_DEFER); } ret = regulator_resolve_supply(rdev); if (ret < 0) { - regulator = ERR_PTR(ret); put_device(&rdev->dev); - return regulator; + return ERR_PTR(ret); } if (!try_module_get(rdev->owner)) { - regulator = ERR_PTR(-EPROBE_DEFER); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-EPROBE_DEFER); } regulator_lock(rdev); regulator = create_regulator(rdev, dev, id); regulator_unlock(rdev); if (regulator == NULL) { - regulator = ERR_PTR(-ENOMEM); module_put(rdev->owner); put_device(&rdev->dev); - return regulator; + return ERR_PTR(-ENOMEM); } rdev->open_count++; -- 2.39.2