Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp637216ybl; Fri, 10 Jan 2020 04:23:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzdJrqLU3bGlL5RkKv9DLpE7Cigl1A+33URd0EVRupV2MsYAixPG67gXw3UUxWG6Z47lM4+ X-Received: by 2002:aca:3354:: with SMTP id z81mr2023291oiz.129.1578659024433; Fri, 10 Jan 2020 04:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578659024; cv=none; d=google.com; s=arc-20160816; b=K9mGBrIdxolfAZNDLALIORmYJDHB9mAGaECaoHl6vJhgJA27WHCNtYGCsGTDKOyiAk zX06VHkX6DeWkcCQ0aNWhRDf3zQtl72J/JV+YsPwMeMDHriUi3Z6XRunlqDHDtkXXyTC O5W7aq1TSmdo6auWr1Gss5qkIWZGcPdUio9dg7DV/vFnZ2kQ2vGpDQ1olAo83wZIyY+f Z8Iwra7FajKtcJUOciCUgMxrkKIPRMt6Ui3+Ua2atGEa+5G4Bw92EEU1ZT3hwkfyywGw Jico1SrjCSgKvkIAP75dIhBHnwRrOhWTbdfpYx1oucxmqackgdCoUrybYF9k5IjUj0L4 VYZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lP97DAgOt29HYi5HxndkZYLCESznFar+zUtt6iPxAL4=; b=Y9uXxCsW0xt/UPQuHOGNZpLx9xHPvs7wlIlApjUOBkWa0ruD0xTVOqx8732OO3VOkG I4nayxwnbqbkQYPnGmbsGVZeWPRRi9dd7dNCQWhlZYcK/+hfz10CmPV9nnJS5dyFMUFB 4JIUkfQSNRn2xsvGdTM85kmruo3oef5qcBI3kgdpFkWt1c+MVKIdf4HI2Yme96Q4lvUp QFW13cbLUPvaN9rpgJhY2+cSaLz9GRZy3ZHoQ5j+AzIj8REtf4vksQN1dpI7+kSEnhPc xaddCd9pd1eWpa6eo6OVJGrmVzNY7sCq1ZBxXlHzhbGrBBRoIazzSFzOP61buY5Mlly6 vI1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si880187oib.164.2020.01.10.04.23.32; Fri, 10 Jan 2020 04:23:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbgAJMWe (ORCPT + 99 others); Fri, 10 Jan 2020 07:22:34 -0500 Received: from foss.arm.com ([217.140.110.172]:43746 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727937AbgAJMWe (ORCPT ); Fri, 10 Jan 2020 07:22:34 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A8A951063; Fri, 10 Jan 2020 04:22:33 -0800 (PST) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5AB23F534; Fri, 10 Jan 2020 04:22:32 -0800 (PST) Date: Fri, 10 Jan 2020 12:22:26 +0000 From: Sudeep Holla To: Viresh Kumar Cc: Arnd Bergmann , Vincent Guittot , Jassi Brar , "linux-kernel@vger.kernel.org" , Linux ARM , Sudeep Holla Subject: Re: [PATCH] firmware: arm_scmi: Make scmi core independent of transport type Message-ID: <20200110122226.GA45077@bogus> References: <5c545c2866ba075ddb44907940a1dae1d823b8a1.1575019719.git.viresh.kumar@linaro.org> <20200109091613.fx2ggmmjvgjempks@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109091613.fx2ggmmjvgjempks@vireshk-i7> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2020 at 02:46:13PM +0530, Viresh Kumar wrote: > On 09-01-20, 09:18, Arnd Bergmann wrote: > > > +static int mailbox_chan_free(int id, void *p, void *data) > > > +{ > > > + struct scmi_chan_info *cinfo = p; > > > + struct scmi_mailbox *smbox = cinfo->transport_info; > > > + > > > + if (!IS_ERR_OR_NULL(smbox->chan)) { > > > + mbox_free_channel(smbox->chan); > > > + cinfo->transport_info = NULL; > > > + smbox->chan = NULL; > > > + smbox->cinfo = NULL; > > > + } > > > > There is something wrong if smbox->chan can be be one of > > three things (a valid pointer, a NULL pointer, or an error value). > > > > I see this is a preexisting problem, but please add a patch to > > make it consistently use either NULL pointers or error codes > > and remove all instances of IS_ERR_OR_NULL() from this > > subsystem. > > This isn't a subsystem problem actually. mbox_request_channel() never > returns NULL on error. > > @Sudeep, do we really need the IS_ERR_OR_NULL() check in > scmi_mbox_free_channel() helper ? Or can it just be IS_ERR() ? > It can be just IS_ERR, just not noticed it so far I believe. -- Regards, Sudeep