From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 276F1C54EE9 for ; Tue, 27 Sep 2022 11:57:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 322E284CE6; Tue, 27 Sep 2022 13:57:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="k+3LvMjT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B34884C4C; Tue, 27 Sep 2022 13:57:08 +0200 (CEST) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B9D5484CFE for ; Tue, 27 Sep 2022 13:57:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x631.google.com with SMTP id a26so20189419ejc.4 for ; Tue, 27 Sep 2022 04:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=ZbU0YKQbCw0sX06zPqb5aKDyRezoyEAjmADE/u8ClnU=; b=k+3LvMjTGuPVYfzziuUe2GQcDewaKHkToh82r06aRWe1SnGp6HX4+pM7CcxMh3Bzvk 7fgvAcEuDDuesw33kPhZA7jdf3DFk7yaEBV8Q+AO2/83jqCtdJtlbFamK9xOtFo7yuHA STe9+qvlx2snnOhPwkTPZCk24zJxDkIr4qdrV0EXzsU+a8aEEpis0LamVsbbp09cAyMP MHsxDQO2yePD0s0NHPHn2MaxNLaVfbRwWCYaYnXZEMy5G2/vh2nP8WYWT7KwD/TAOEEU x/jJy+zCjzNiVkXy8VLXk77cGCMesR6F8nt2yNrD6Viz+6t69cu0Wqmi2S3zegNGvWiV 73nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=ZbU0YKQbCw0sX06zPqb5aKDyRezoyEAjmADE/u8ClnU=; b=3YkVtuQcPtBxCuYnUs7rLeOvLeeEJ6du18mMfCsTaT14kykAIoYt55alg6vZrgmgbd P+2xQ8Gj6ZrwF8rNN2dzogI3eYMtWJwV7nddse2AcDBBOumaUXUDg6U93vnoKdR0ifIg 0LwCz6Rnq59t3aZ7VK5GA5JLK6imaBEF1sgfYAOkMf5RsKgu0bFS6gi5KspNgyPJLWVl H6Bxli1uOtJhlwbV6sVDRzg9ghx+k8fSIZtu7kWqbqnqSSww9aTTvt4usVgvxriDRhcq MEfFNEc6S/fkWqG+Xo58NykeYU8ITzKvrr7sIXdzFXCzme+FJi8w7O7Pat4kHKGIVQQw 5puw== X-Gm-Message-State: ACrzQf07fVURZSRueFcERpYHi6cbyeCmJhFx2xDBQJCah7SObBLbQMdy 7jEl68yT5n7A8XOhyRfsGwlwWw== X-Google-Smtp-Source: AMsMyM5/d2T94Hw2JnvR4G5IeD9V8WNHbt7EkjUb1mtTVilSsaF2maKfJsPp2SCXZqDQFs8YaFmgag== X-Received: by 2002:a17:906:fe46:b0:730:ca2b:cb7b with SMTP id wz6-20020a170906fe4600b00730ca2bcb7bmr23236118ejb.703.1664279825285; Tue, 27 Sep 2022 04:57:05 -0700 (PDT) Received: from hades ([46.103.15.185]) by smtp.gmail.com with ESMTPSA id j9-20020a17090623e900b0077f4f63a6f4sm692777ejg.112.2022.09.27.04.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 04:57:04 -0700 (PDT) Date: Tue, 27 Sep 2022 14:57:02 +0300 From: Ilias Apalodimas To: Etienne Carriere Cc: Sughosh Ganu , u-boot@lists.denx.de, Heinrich Schuchardt , Takahiro Akashi , Patrick Delaunay , Patrice Chotard , Simon Glass , Bin Meng , Tom Rini , Michal Simek , Jassi Brar Subject: Re: [PATCH v10 03/15] FWU: Add FWU metadata access driver for GPT partitioned block devices Message-ID: References: <20220915081451.633983-1-sughosh.ganu@linaro.org> <20220915081451.633983-4-sughosh.ganu@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hey Etiennem [...] > > > > + uint *secondary_mpart) > > > > +{ > > > > + int i, ret; > > > > + u32 mdata_parts; > > > > + efi_guid_t part_type_guid; > > > > + struct disk_partition info; > > > > + const efi_guid_t fwu_mdata_guid = FWU_MDATA_GUID; > > > > + > > > > + mdata_parts = 0; > > > > + for (i = 1; i < MAX_SEARCH_PARTITIONS; i++) { > > > > + if (part_get_info(desc, i, &info)) > > > > + continue; > > > > + uuid_str_to_bin(info.type_guid, part_type_guid.b, > > > > + UUID_STR_FORMAT_GUID); > > > > + > > > > + if (!guidcmp(&fwu_mdata_guid, &part_type_guid)) { > > > > + ++mdata_parts; > > > > + if (!*primary_mpart) > > > > + *primary_mpart = i; > > > > + else > > > > + *secondary_mpart = i; > > > > + } > > > > + } > > > > + > > > > + if (mdata_parts != 2) { > > > > + log_debug("Expect two copies of the FWU metadata instead of %d\n", > > > > + mdata_parts); > > > > + ret = -EINVAL; > > > > + } else { > > > > + ret = 0; > > > > + } > > > > > > Can we change that a bit? There are are some assumptions in this code, e.g > > > the user must pass the values zero'ed out. Can we instead get an array of > > I don't agree. If the function returns an error code, caller shall not > use the output content. > That is what callers of gpt_get_mdata_partitions() do in this patch, > so returning -EINVAL if fine. > (note that I don't mind this gets an array ref rather than 2 pointers). Ah true. In any case I still think we should change to an array, imho it would be much easier to read > > best regards, > etienne > > > > 2 instead? In that case you don't care if any of the values are zero and > > > you can just fill in the array. Something like: > > > > Okay, will make use of the array as you suggest. > > > > > [...] Regards /Ilias