Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp746598ybt; Fri, 26 Jun 2020 10:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNDS8kDXsT4ylhILNe06pYTvGzm+lICrg+EpEu2TQmgGrpYLEPXlczHTqufd/Vl+TI/iEO X-Received: by 2002:a17:906:3958:: with SMTP id g24mr3413091eje.26.1593192674463; Fri, 26 Jun 2020 10:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593192674; cv=none; d=google.com; s=arc-20160816; b=1EL/6aQxLFRVQSe+qG8ZMYSW2Timx5Oihr2QepBctbCzyl/5Euw/GdZ5i3ycoToPNf p6nq9+tmOJAlx/RGFJWt8kBKc1Tm46OklXKXc1Q7L66l5RmmGkM2UVgC+vACol77xUut fD+qNGnUrVA7o0JrRTuFCGw2rCnLh+rk4bzrQ4IS0vDZnaLWKNiiJryORvFzgBsbWCNx ipN3DYPEKEdmYpfaQja9daVLpAqO9IdDCtRtbuGDJyQdsrYJwdwMgPrRtojtzZbK+xpK rWzwxoRikYL6cI0A142mCRN0Ko8TlDBnVFxpvpDYQwBo7zZKJuKGvhRFE1XCXsTC/CzZ SWjw== 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:dkim-signature; bh=ftdr6mHim54L1C0LjxRdGjksokmlNmltTbluVqJWzgg=; b=Pxpx76Fc2EZUpC0mXvBFXps3cr3C90ZiqhiF6gTnHeb2Xl2+WJ3TBjIObZXsyOdmgX W1aL1A6L00QeKwIDMbjoz7hJbt0mXD1E9x2Ks3Q/bvXSLAuhX9WbEpozK8bhoDqWqNRe 1WQxUwBdaGrmz23dvzoXdugB8IVR0sMtuLuqMYOqtRmPt4728RUv9wfDyZi9iIE3B3wn IxUhTMVOI502pA58qZ00B+3/MaNyyKAKhNpUlELIAdzYBpY7xHX02PkzTpwf3hkptyTJ vIDah3BfFQFS2UHUchAmcsbfy31Ds0rUcDIIzyEi/hBrdwpfas6LlEBxTTY/sQUdGq+K D9Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=ff+Aldsa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs23si6801562edb.562.2020.06.26.10.30.51; Fri, 26 Jun 2020 10:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=ff+Aldsa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727880AbgFZRZG (ORCPT + 99 others); Fri, 26 Jun 2020 13:25:06 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:35040 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbgFZRZF (ORCPT ); Fri, 26 Jun 2020 13:25:05 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05QHMYvR009908; Fri, 26 Jun 2020 17:24:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=ftdr6mHim54L1C0LjxRdGjksokmlNmltTbluVqJWzgg=; b=ff+AldsaEEavTREY/UndN4fxK9RRCxWg6o7vMnL9Jr+465fnvPdA8INlJTr9fdoROhcn eonn5wv+4p1LxIVUTknAE2AVQTpTwZ6/dhkF0EB0CB2fsjIZqlzXrfVaEH5yGV8bMq5N pJ+IbL1tVs9GSsRSRPdKD7X3MidA+wnWohu1dW2cfXcmqzb5CrNg918MkZWy14LkVGPt o56EddzV2FsiSc9AIFmGJm8LWeFrF1jFEfIgMnww7SNvNK30WqS+mmVctGJY31XjW/XI Jj5D580JHjA/IdzgaOpK89Dw3GE9EmRA+75YJN0P+VbK7lupWuERZvkjQjWGUSkpZG2i Wg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 31uusu79b4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Jun 2020 17:24:33 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05QHMM9v098753; Fri, 26 Jun 2020 17:24:33 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 31uurctv1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Jun 2020 17:24:32 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05QHORRU016433; Fri, 26 Jun 2020 17:24:27 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 26 Jun 2020 17:24:20 +0000 Date: Fri, 26 Jun 2020 20:24:11 +0300 From: Dan Carpenter To: Pawel Laszczak Cc: "gregkh@linuxfoundation.org" , "robh+dt@kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "balbi@kernel.org" , "devicetree@vger.kernel.org" , "ben.dooks@codethink.co.uk" , "colin.king@canonical.com" , "rogerq@ti.com" , "peter.chen@nxp.com" , "weiyongjun1@huawei.com" , Jayshri Dajiram Pawar , Rahul Kumar , Sanket Parmar Subject: Re: [PATCH RFC 2/5] usb:cdns3: Add pci to platform driver wrapper Message-ID: <20200626172411.GE2571@kadam> References: <20200626045450.10205-1-pawell@cadence.com> <20200626045450.10205-3-pawell@cadence.com> <20200626114057.GD2571@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9664 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006260122 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9664 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 cotscore=-2147483648 malwarescore=0 mlxscore=0 clxscore=1011 lowpriorityscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006260122 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 03:10:32PM +0000, Pawel Laszczak wrote: > >> +static int cdnsp_pci_probe(struct pci_dev *pdev, > >> + const struct pci_device_id *id) > >> +{ > >> + struct platform_device_info plat_info; > >> + struct cdnsp_wrap *wrap; > >> + struct resource *res; > >> + struct pci_dev *func; > >> + int err; > >> + > >> + /* > >> + * For GADGET/HOST PCI (devfn) function number is 0, > >> + * for OTG PCI (devfn) function number is 1. > >> + */ > >> + if (!id || (pdev->devfn != PCI_DEV_FN_HOST_DEVICE && > >> + pdev->devfn != PCI_DEV_FN_OTG)) > >> + return -EINVAL; > >> + > >> + func = cdnsp_get_second_fun(pdev); > >> + if (unlikely(!func)) > >> + return -EINVAL; > >> + > >> + if (func->class == PCI_CLASS_SERIAL_USB_XHCI || > >> + pdev->class == PCI_CLASS_SERIAL_USB_XHCI) > >> + return -EINVAL; > > > > > >Do we need call pci_put_device(func) before returning? > > We don't need. > Such function doesn't exist. > I meant pci_dev_put(). I'm pretty sure that we do need it to match the pci_get_device() in cdnsp_get_second_fun(). regards, dan carpenter