Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751614AbdLNBcl (ORCPT ); Wed, 13 Dec 2017 20:32:41 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:46091 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbdLNBck (ORCPT ); Wed, 13 Dec 2017 20:32:40 -0500 X-Google-Smtp-Source: ACJfBos8uDV3H9e82Snt5gTn+CwK7ab7oguoQh//Xs5HPWzEsUfhYZlT0DuKfi4X3BteBwX9U4QlUA== Date: Wed, 13 Dec 2017 17:32:36 -0800 From: Bjorn Andersson To: Loic Pallardy Cc: ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, arnaud.pouliquen@st.com, benjamin.gaignard@linaro.org Subject: Re: [PATCH v2 11/16] remoteproc: introduce rproc_find_carveout_by_name function Message-ID: <20171214013236.GL17344@builder> References: <1512060411-729-1-git-send-email-loic.pallardy@st.com> <1512060411-729-12-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512060411-729-12-git-send-email-loic.pallardy@st.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 661 Lines: 28 On Thu 30 Nov 08:46 PST 2017, Loic Pallardy wrote: > +struct rproc_mem_entry * > +rproc_find_carveout_by_name(struct rproc *rproc, char *name) In almost all cases after this patch you have to do a snprintf(), so it would be better to make this function format the name based on a format string and variable arguments. > +{ > + struct rproc_mem_entry *carveout, *mem = NULL; > + > + if (!name) > + return NULL; > + > + list_for_each_entry(carveout, &rproc->carveouts, node) { > + /* Compare carveout and requested names */ > + if (!strcmp(carveout->name, name)) { > + mem = carveout; > + break; > + } > + } > + > + return mem; > +} > + Regards, Bjorn