Received: by 10.213.65.68 with SMTP id h4csp368662imn; Wed, 21 Mar 2018 21:51:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELv0ohTQNo/vLe+akxZUFkcK0Oqk9f/uMLjWD6ZMUnnW4NaRRRei4zK0ty+by6L35v9EgiVv X-Received: by 10.101.90.140 with SMTP id c12mr11213463pgt.191.1521694278750; Wed, 21 Mar 2018 21:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521694278; cv=none; d=google.com; s=arc-20160816; b=0b54HpaANM0Gd7Hehll+S+6t9fc4OeBECn4M18DE8Ry793knOcbnIlpSDt9ij2FlK0 RYmLa/lsUqrrvPtDryXnPaff7a+floKOj3xyRqJSEwGqivSG+U4sLba1ivF/AgVNFJiA 0mHLgVwlC2QXVuxi/S7l+DIYW4ln9cOjKpTiMShZAPi1VGTCNuR7kFmjKZDkadBTbjG/ H1bL5TeWf7GnR/ZEZL6sU0DehI4zssyyZqUdCpebV02EI+ljNt5Be5qx6L6yfhlFUYQw cCGyY8kD3u5MjX+V7Z1Mwz8oFfgLj3VsvjOdXCG1NH2xG6AB2sJ5I+wBgRFBDGlRmIs3 0r5g== 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:arc-authentication-results; bh=YBlsWa4VevgWdBWlyFrURF37chQQ1C7Flvp4TyBHwRI=; b=jjmhjph6r126qyK/u53eLNcRucUO975C3nll+5ZUDml4H7ULzjSHV1LQwxsrvpMlzL p3AG+VVoPYB/2eXb1N3gQA3IH90aKo3V9kOhZY3s0O9b07OM2sJDx5mKT26gUuhRxdWD pa1RzgMopif/4qMXTdAzxgdL4gvQx2cyHszF1pHeJ6lB6DkrR3Bk3alJ3v4Fy1IVjDMQ qvO4r10Y/NODi0pTGxZFw28tUnTIfDjwDZo06lPUWypn04G+lJrKnyOBMGJmmcwWlqmZ pScx2InIEfJFosGr/4B/HSHV8/zm2vL2jXmxl/neElWHCI8eE140udEIQH6xP/CZpdZ/ 2jiw== 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 l9si3781611pgs.281.2018.03.21.21.51.03; Wed, 21 Mar 2018 21:51:18 -0700 (PDT) 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 S1752097AbeCVEuL (ORCPT + 99 others); Thu, 22 Mar 2018 00:50:11 -0400 Received: from mga12.intel.com ([192.55.52.136]:42882 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751291AbeCVEuI (ORCPT ); Thu, 22 Mar 2018 00:50:08 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 21:50:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,342,1517904000"; d="scan'208";a="27832034" Received: from hao-dev.bj.intel.com (HELO localhost) ([10.238.157.61]) by orsmga006.jf.intel.com with ESMTP; 21 Mar 2018 21:50:04 -0700 Date: Thu, 22 Mar 2018 12:40:06 +0800 From: Wu Hao To: Alan Tull Cc: Moritz Fischer , linux-fpga@vger.kernel.org, linux-kernel , linux-api@vger.kernel.org, "Kang, Luwei" , "Zhang, Yi Z" , Tim Whisonant , Enno Luebbers , Shiva Rao , Christopher Rauer , Xiao Guangrong Subject: Re: [PATCH v4 04/24] fpga: add device feature list support Message-ID: <20180322044006.GA8305@hao-dev> References: <1518513893-4719-1-git-send-email-hao.wu@intel.com> <1518513893-4719-5-git-send-email-hao.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 21, 2018 at 06:54:58PM -0500, Alan Tull wrote: > On Tue, Feb 13, 2018 at 3:24 AM, Wu Hao wrote: > > Hi Hao, > > > +static int > > +build_info_create_dev(struct build_feature_devs_info *binfo, > > + enum fpga_id_type type, const char *name, > > + void __iomem *ioaddr) > > +{ > > + struct platform_device *fdev; > > + int ret; > > + > > + /* we will create a new device, commit current device first */ > > + ret = build_info_commit_dev(binfo); > > + if (ret) > > + return ret; > > + > > + /* > > + * we use -ENODEV as the initialization indicator which indicates > > + * whether the id need to be reclaimed > > + */ > > + fdev = platform_device_alloc(name, -ENODEV); > > + if (!fdev) > > + return -ENOMEM; > > + > > + binfo->feature_dev = fdev; > > + binfo->feature_num = 0; > > + binfo->ioaddr = ioaddr; > > + INIT_LIST_HEAD(&binfo->sub_features); > > + > > + fdev->id = alloc_fpga_id(type, &fdev->dev); > > + if (fdev->id < 0) > > + return fdev->id; > > Do we need platform_device_put if returning here? Hi Alan, Actually if any error returned by this build_info_create_dev, it will cause parse_feature_list returns error code and finally build_info_free is invoked. In build_info_free function, it will do platform_device_put there, so we don't have to add code to do put here. : ) Thanks Hao > > Alan > > > + > > + fdev->dev.parent = &binfo->cdev->region.dev; > > + > > + return 0; > > +} > > +