Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1411885lqa; Mon, 29 Apr 2024 07:51:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWRl8sWeaQ66J/iUs/NIVYz/TZ0O1Rf4+5Az54A5+r1PCqaqnUbnNJfxzSJPZGTzwH6mefJI9G46Xn5uewhuzFrPuo8HhGSe1j5BYxW2g== X-Google-Smtp-Source: AGHT+IEKQ4lw/cn8QJtQ0PqRi/f9iP1MD8FQNklTkfe1CsR9AjLM45Hg3vir+PXM7W7X3P+52Hyb X-Received: by 2002:a05:6102:cd4:b0:47c:2f53:b723 with SMTP id g20-20020a0561020cd400b0047c2f53b723mr8635217vst.15.1714402269090; Mon, 29 Apr 2024 07:51:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714402269; cv=pass; d=google.com; s=arc-20160816; b=XV1PAbpCCzTMsbzIrfsBDAZ+7GA7VBRgSb5ox94esB7oe/aAF5m6msLJwSMoIsmVXi 5+T/JiAc9SCFPCTBlFYpwyD+sc7hmZZYPwYcI/1wg+Z40mBHrJNC4q8h1vFCIMa+113d gB6b2+Rh1NK8R6CnnE4Y8xnrPSOTE/6QBBwg8fEHovIiyApIBos9OhMQfXS1/LxHBHJP q9khre7wfnG4qe5oMEJiL7XJaJYVN3RjjuiUL9qtumDOYEe1GFeXSxFCk3ohDeuU9hAk zuAiZjmo4RuKP40J+dVKCK7m954Syi7tk7OWOaZFqdYvSr9Zexv6w7pSeNehElCqNGZY 7RmQ== 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=zXv7GZ6xqS/inIO61f+8bOmFF8xiVpcCr2CzPlXRNMU=; fh=9+JPiKUqmiwg7nrgynbn+qu8x0UhUJwyp0gAHVwwYQs=; b=1KZfZTKqZG/JpByaEvVqSm2CTqYkllyWJ91/hN+V0ywBIDsod0fUuqNMG28mrog5pD +lEzHTht4bc9Qc3jciJBKkdKRmzRXNDXC4ED1mcQxRonq900P8WbkIJ5BjJagUa0jsq6 rxTjnv40UEabD3pyGG5KefeARzWbhC+ynKGaA/Zx7riSSnM7Oe6yMVchq7KArCxs8HQg J887DDnQHsgdRVeEedbcq8Nx92/BvueinrLswsYOnOft4n0lfBiCQddpQLCQFbFLoxCb 0cpjEI4yAdzQ+KG3iKJBGJcqSdghFTd9xaWnZIL1or9izCInCydMEQNbRZgxXtK7Po/B CblA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=cR4NfQRT; 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-162488-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162488-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 t26-20020a9f389a000000b007e3e137f1ebsi3889503uaf.102.2024.04.29.07.51.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 07:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162488-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=cR4NfQRT; 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-162488-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162488-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 C75961C217BF for ; Mon, 29 Apr 2024 14:51:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF3017F7C3; Mon, 29 Apr 2024 14:50:59 +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="cR4NfQRT" 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 903CD7EEF3 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=1714402258; cv=none; b=cVQuoY9fUNDsLf558abJ7UZLFXvVAxjEcW8L6NthFR2Aoje/VzZH2R3/x+MfxYA+N81fsJuTAY8FjAuoGnTNNqcpKYQjdskkfl1AAK1Y6aMlXjt/qgYJmggCezSwllMdB/GVQ8i7gnJ0sB5tcq98C2bPDUZKsG0E5VQIEi9j8YI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714402258; c=relaxed/simple; bh=27EreRFOAHgU+jSBmIoV3nR5fKGUFarI3dQ5IBk0P9Y=; h=Date:Message-Id:In-Reply-To:References:Subject:MIME-Version: Content-Type:From:To:Cc; b=fMEGeHx8N+hYYWYV9u43pl4bqUYZEDH4+2UikEXKaB/ic4oOId2mMAoltirH9Zp3IkRuATpjaHMqXb9rA5ohJ2b67lVmCCP8c6YKwl3Dh/ZonfYdG6yrXiI3+6fK2YI/seTn3KOisx487+FXZivEJKCtV4uDYzCu/ox1wcG2m9Y= 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=cR4NfQRT; 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=1714401928; bh=27EreRFOAHgU+jSBmIoV3nR5fKGUFarI3dQ5IBk0P9Y=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=cR4NfQRTMafP5SvYwBsJ4ywJrRbJF/UMVO1dqiIyf05cBx0AOZyjb1+Wax5LgjEqW W9yeY/RBnAs81MwnUuuMpzq8zfCcFkx7b0BQdlLuuWbTz/kVbCUoO58CapcRgUeo9l mw7lTUgWx5NnaW0He+0pQZeNv5JkXvgsWKEauYjbl4DkKUhGqXMGuS99mynmETeh5T +3bNgTQO7mLnACD5+bZDDT1QriOuRYbn7xKoB6xKC3+urr/tl31WHndV7Q0FP8cNOD Xbgil78aH0OrlbVvWb/AMRzCpdbdgil8lAz0XdlVBPgFHFa3fRujQLw/FnDmPXsLM9 emHodgmZwjqgQ== Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4VSmMr60flzDJ; Mon, 29 Apr 2024 16:45:28 +0200 (CEST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 1.0.5 at mail Date: Mon, 29 Apr 2024 16:45:28 +0200 Message-Id: <1ec1a8090c0e316ee005629c24f2779211e0aebf.1714399603.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: Subject: [PATCH v2 04/12] regulator/core: regulator_bulk_get: remove redundant NULL stores 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 On error, callers of regulator_bulk_get() pass the error up and don't use the pointers in consumers[]. The function is documented to release all regulators if any request fails. Note: if an i-th regulator_get() failed only the i-th pointer was cleared. This is another suggestion that the clearing was unnecessary. Signed-off-by: Michał Mirosław --- drivers/regulator/core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 3d7147fabbed..a1573a7ff2b2 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4872,11 +4872,7 @@ static int _notifier_call_chain(struct regulator_dev *rdev, int _regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers, enum regulator_get_type get_type) { - int i; - int ret; - - for (i = 0; i < num_consumers; i++) - consumers[i].consumer = NULL; + int ret, i; for (i = 0; i < num_consumers; i++) { consumers[i].consumer = _regulator_get(dev, @@ -4885,7 +4881,6 @@ int _regulator_bulk_get(struct device *dev, int num_consumers, ret = dev_err_probe(dev, PTR_ERR(consumers[i].consumer), "Failed to get supply '%s'", consumers[i].supply); - consumers[i].consumer = NULL; goto err; } -- 2.39.2