Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp261310lqs; Tue, 5 Mar 2024 00:50:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0rS8oK+VtsSaExmWDqIgIkXahTbYYbdfXsthAAFmPzxKLb2G1+qvwgL5ZfzUf7qMz3WQJB3LahRvCtfGImhxievHoxk1mO7tJpjNqXA== X-Google-Smtp-Source: AGHT+IEow+3iCtyT7/xclAz5g+5JFO6tC2yg6a0y6yVfr1Qo4sB9j3XjcgsXQlEbTfLDhPZBVGLg X-Received: by 2002:a50:fa85:0:b0:567:80c7:33b2 with SMTP id w5-20020a50fa85000000b0056780c733b2mr1140958edr.29.1709628645639; Tue, 05 Mar 2024 00:50:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709628645; cv=pass; d=google.com; s=arc-20160816; b=0XYX5H4Mn8l2ArB1VyPxlCI+/c65iUIJFVCap5B+kofIPYhdOj1v2TjUmpx9mcuhB9 6wBzxL4H9TyVK6dOB8kBh8VrCqk+CIqpIHZc9pEGGoMhFCFm/Gd+V5+Df0dzkSKP2CZr tCZp7sWaUmYA1Bt78W5nCS4cxnDggMe+CzK66aKkUl2F45uT+azIr8vDb7SlhuWTiy+c qR6djzb6vB3GIvjGdugoPyLQ5cVhuD8mcVlPZfY6PVwGhp5I9brUVEFOcWQOR8SeEqef 4Nn+0R3/ukjE7xvcG20B7n+A6ekRNRBXsSFRiLE6Dv0T9nTKgO5SCsvaBxzQDbYGE4EL GrwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jT7ZsmNph1HICQhGYk/X5PZRUWWUGk3/PHQvVwvJTOo=; fh=Eml4l6arwwTeu2tF2a63zqqMZo49Uu0MQ2QDHBtc0xA=; b=J2+XImhEIPdk+YmfvKWjYrLSh/i9tx7QgdcoHQM4sG4ec1MI9QY8enC+HbfaFWlCzN P28OVfw7aqAkbX7tS2hVsYRwljSYVlh+p0XJMmGSdmJAAtGmThwZgK+In/z57Sh6f5L/ KnGVbfu3TBifSq2p0hXCueRawWThniPvIBB6m3fjWc+EiAB+M1G/z6CCfMbY7YFWD1Oi cPXIajF1TggoYrs/rWxR0gYEBNy6lWsovVku0JX0IOML5SWhy/eoTg52K0EBWRznM+De yQF3lNvxjE3vwK/+YAULpJWtI1hldsh+W9+fwp5YHReI5z/4Dq6g3q3hDJysZCjIpn2l ZJIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wgB85y0s; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-91928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r20-20020a05640251d400b00565afdb9ab1si4673700edd.548.2024.03.05.00.50.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:50:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wgB85y0s; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-91928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 D149C1F22E2A for ; Tue, 5 Mar 2024 08:50:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E3EC4F215; Tue, 5 Mar 2024 08:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wgB85y0s" Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB9A84DA1C for ; Tue, 5 Mar 2024 08:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709628637; cv=none; b=LAW4L+pl+NN9/2iLYskKcHWPbRrO3uKr1Y4y1vvxS38Oo1FDLcwCI3ZCINC0l5zcTqLyaAaV6noDgFWrXVA6jlhRyki6s9yxJU+LwzCjFuTwln+hyEcFWCY3ZpfYm9NC6PufLS3XM1Z2pg6quC01hsKg4D+cRLOWvIXrTIrBKls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709628637; c=relaxed/simple; bh=/qaRgOCPIEFkrZRFeRFcZiqUAPgGaXs8wvM/tEPQzCw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lhEQl6L5RZupsndSofzGmfTWtFeXQVjW4x0wn0SGkpVhffpHgqoPYi6ie1RxCGvnOBiiOmhj6fGltHTv2SMo4ayzEiTR0gUCPsrdO39z1yAftrBgSJmK4mAAt4XcvZXumFUh1nD1GRfoc4cBb8dvppcs6bj4FxtBvT9jOZ//QMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wgB85y0s; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-563d56ee65cso8124640a12.2 for ; Tue, 05 Mar 2024 00:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709628634; x=1710233434; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jT7ZsmNph1HICQhGYk/X5PZRUWWUGk3/PHQvVwvJTOo=; b=wgB85y0s6rf4i2vIzrgObujA09hgoBt7adI9IZOTwi6FrRA3PMf5vJ1An2UTkwImsU Py6ZjRaJJnJebSDWj3EmZq9+uUAp1+cMTmlyYOCzD5bhdAPTdZpX52Y0BKKIBVD35571 bOs0aK7sVzcqTsaFRjYipop4g9HDrbo098GQ5TpomE6nI1oHeU6GtT6O3lSrcP0/KAdi Ptd3+vHAqD/wd2kngPt9owa7iEyo/yazTT7OnHd8qkKwUrOY7MgIbGdngUs9Lcbaqr40 PjzUYwxQ1o6T3NfcqPUkMRM5Iwj+bfb621d0+/sLHgbHnVFSgvDRa1PpZ9v51iX9nqt8 ATrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709628634; x=1710233434; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jT7ZsmNph1HICQhGYk/X5PZRUWWUGk3/PHQvVwvJTOo=; b=gxLbMcTx7wf+Qn//TndJjxLX+mYs2bJhcTBkzdv4dhtV7Sfux/JW+ek+ZfJGkKnXtB HZI1ohbrgl8sdcM3u1pNxb4YBgiHWAnVxI/JKbyZJ3ubHpHAY/tfEuBbzj7rcfl+d8gY FBbUEy3BUuwEKuXPPQBDxQ2FBI7mNmFTRhMLjkzua8/nnMIqmBkNoP7Ix2aGTN2XnXQ6 VEmOUn6UtIRl5rITEAgORSpGpibswumRVuPlnLO/ODi2I7efdDL71h2qaGFsQl8f+zTY nxhmVbJMzbinRsgHGAGBPxNSpD/fI4sylD03aUnw7i9FeE7bUX3NEq3Bk01gkI9d4DUC 8w6g== X-Forwarded-Encrypted: i=1; AJvYcCUmBWuBIGTxsmV8Dss+loOzwXQe3W0P5G63ybBuReP2gH0JptZzi9ryHR6aMNSF2VC8orxqudf1Y+ab9XFdYtYq1kkxb42NELYyiLOs X-Gm-Message-State: AOJu0YyyYZPJDH7vnurM8HMQjJYuXlBMHcad1S1wN2I0ljQ6h+lVSjLW N2WhxI15jzqdOVYGK7Q6Z8YsxD39auYkmQANRWXmXqu97/ji2TJjOy9kOOXabdg= X-Received: by 2002:a17:906:c06:b0:a44:1978:c73f with SMTP id s6-20020a1709060c0600b00a441978c73fmr7660917ejf.61.1709628633846; Tue, 05 Mar 2024 00:50:33 -0800 (PST) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id ef5-20020a17090697c500b00a449cb924dbsm4457506ejb.124.2024.03.05.00.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:50:33 -0800 (PST) Date: Tue, 5 Mar 2024 11:50:29 +0300 From: Dan Carpenter To: Shradha Todi Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, jingoohan1@gmail.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, linux@armlinux.org.uk, m.szyprowski@samsung.com, manivannan.sadhasivam@linaro.org, pankaj.dubey@samsung.com, gost.dev@samsung.com Subject: Re: [PATCH v6 1/2] clk: Provide managed helper to get and enable bulk clocks Message-ID: References: <20240220084046.23786-1-shradha.t@samsung.com> <20240220084046.23786-2-shradha.t@samsung.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240220084046.23786-2-shradha.t@samsung.com> On Tue, Feb 20, 2024 at 02:10:45PM +0530, Shradha Todi wrote: > +int __must_check devm_clk_bulk_get_all_enable(struct device *dev, > + struct clk_bulk_data **clks) > +{ > + struct clk_bulk_devres *devres; > + int ret; > + > + devres = devres_alloc(devm_clk_bulk_release_all_enable, > + sizeof(*devres), GFP_KERNEL); > + if (!devres) > + return -ENOMEM; > + > + ret = clk_bulk_get_all(dev, &devres->clks); > + if (ret > 0) { I feel like this should be >= instead of >. There aren't any callers of this function yet so we can't see what's in *clks at the start but it's easy to imagine a situation where it's bad data. > + *clks = devres->clks; > + devres->num_clks = ret; > + } else { > + devres_free(devres); > + return ret; When clk_bulk_get_all() returns zero then we return success here. regards, dan carpenter > + } > + > + ret = clk_bulk_prepare_enable(devres->num_clks, *clks); > + if (!ret) { > + devres_add(dev, devres); > + } else { > + clk_bulk_put_all(devres->num_clks, devres->clks); > + devres_free(devres); > + } > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all_enable); > +