Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1435454lqa; Mon, 29 Apr 2024 08:23:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxKe/DIe8XqwqxEVKUrBXTaqMQp//cINhn17LUGYLzjVX5gZmNJTpOJSSfjTrudZhZrMYwU0vFc18N8ANl5wOQhcW6gdLcSUlSbYT/ig== X-Google-Smtp-Source: AGHT+IEBwkCYWC/gEYaqKFTp50F4MVBIRbEAc/xTxE20uCZJoTAcsoy59Jl+UHoD6RPGWHwzLZlh X-Received: by 2002:a05:6358:820b:b0:18e:ea41:75f6 with SMTP id d11-20020a056358820b00b0018eea4175f6mr3920528rwk.5.1714404183967; Mon, 29 Apr 2024 08:23:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714404183; cv=pass; d=google.com; s=arc-20160816; b=OYKb3mikn9IJBh3mqAsYs2CTlbebyZ/TYB6WkPGJ2FOJQqOWmMRoP0hviWRB6iCNoe rUKCaILfefhN4tvP8XDwqlDGLCTknW2/tuxwvS7hj2scRtt1rXR1aUA0rEDmW+UO6YwE Boivi9O8/AxQhdf8Li3Gk4r3N8Pmz2YE08/T5LEMsn6o2k6QdFBoSw3ZXMj5Kcfw5S7P ofVTZL+FRS8WmiPRGxC1VHLmLvwYeKPDwEnM++O7/LZZ53eP904pIzPH5JlLNuv7syUP Ir3JQ1Tqv0VKi/x9YCMSbsFPghSxYGDT78SzRgHrjUrSp7/PxSwVCR0XQWlaAARvfhgW wdkg== 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=3Imp37zvBZOunsjrrsi1Z5lzgoAws36CR+7teAHSXHQ=; fh=9+JPiKUqmiwg7nrgynbn+qu8x0UhUJwyp0gAHVwwYQs=; b=ZJg6gD96NjZfFJTtuUNHgN3TQHJ07MGS/0Iwe6qbEBAOl3XL6HLsciIDI+gmxXe/O7 Zu/OrpjgOZxeXITCiShyrWYU8sVE2dtMbRyhukFpsJDqB26RA5eJu4LESXwlEDaXq8QY 48gN1zvN6yUbiuANXQlGBVLACKHl0f8tui/RXfpZ5AfQzZG5LDGyEAaGh6otUxET3V8i YaTktHFA5HkUCnUougu7kS2QzIsbUPx+uzM5T+N2g+BiEGF5231qIISZjIWwtdDtpD9h Zk5DMRq3IOowxVB4n9wd+COoiM1EguZEsbfJ9GQn1DFwa+AkhcOk16TM0lSGqL0HFiAu PvMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=CXNBUgdO; 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-162489-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162489-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 sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bx26-20020a056a02051a00b005e49cd906d6si18202332pgb.97.2024.04.29.08.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:23:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162489-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=CXNBUgdO; 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-162489-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162489-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 644CAB221A0 for ; Mon, 29 Apr 2024 14:51:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EA478172A; 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="CXNBUgdO" 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 904087EF18 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=haRX6ME3VkKmlvnQ/5zpo2iXA1F8jyY34G1/Eub1tKoShXe25M4TNicWxJadQAWtCwe7OqZz05PaubpIfQRDf2iFpS4SSPwSFqtnf7FMZhxnbJ0GBQQ4UneO/aYqsywUofFAZkS9eABANn6i4e1KEkjcDTc9QcR1WTy9DbvFMtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714402259; c=relaxed/simple; bh=LPUEFAe2CFZFvNUk6/2zfnIXl6UTcgi77ORqhlB5NFU=; h=Date:Message-Id:In-Reply-To:References:Subject:MIME-Version: Content-Type:From:To:Cc; b=MZnbEX1YKvRm252++bu7POu7XWUqoIMJ4Gx4vnwDciS1p+CP1MYXND9WUCbvaDbDEOcHRb+qS0z5PV4l5jFjN+5PSpNbvrUQrLf4C4xD3Lvzwn/lG0qhEFM3kfxPo8p8flQEwrBhTHkHsl/I6ZajSd8VVyDvhVrCkRSnhsvN8X8= 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=CXNBUgdO; 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=LPUEFAe2CFZFvNUk6/2zfnIXl6UTcgi77ORqhlB5NFU=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=CXNBUgdOn5PNXgtyDNwXHO8yQOrEkUxX54+HLpUqqlmPCxNpmwaO4VcqfAGzitumj kMM5ltDX112P8EZk7MFGls3nhyXJfeysaS1C5DXOir5WwYRJQNTsOPeH8SwrTjsJil mnCcRq1nZd2X0FNGxsZd8xfDXdyhvLrKGbEC/g3ahNDVr9CbUuGpW+rqZkBDwMa5S+ rxtxcee5ggpTAKmyCrkmKryRC/qY4V4QOkaRIs+YVqCDffKcY6zU03+hrs1Avpl7qP 70ULbKdGL5+YBiSjD6IOORV1mbCgIQpTNvAhMVr2yYSjmSmyqbmFtaIu62fWrvJft/ Nii0ChNLj3/Wg== Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4VSmMr0vyHzBL; 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:27 +0200 Message-Id: <17f0bcb197b82e6a7bd8860178a363c96f85572d.1714399603.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: Subject: [PATCH v2 02/12] regulator/core: set_consumer_device_supply: remove `has_dev` 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 `has_dev` is only ever used once to check if the name is non-NULL. Inline the check and make the intent obvious. Signed-off-by: Michał Mirosław --- drivers/regulator/core.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 62dd3ac19e6d..5db3bf08145c 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1738,16 +1738,10 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, const char *supply) { struct regulator_map *node, *new_node; - int has_dev; if (supply == NULL) return -EINVAL; - if (consumer_dev_name != NULL) - has_dev = 1; - else - has_dev = 0; - new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); if (new_node == NULL) return -ENOMEM; @@ -1755,7 +1749,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, new_node->regulator = rdev; new_node->supply = supply; - if (has_dev) { + if (consumer_dev_name != NULL) { new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); if (new_node->dev_name == NULL) { kfree(new_node); -- 2.39.2