From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030654AbeAONxO (ORCPT + 1 other); Mon, 15 Jan 2018 08:53:14 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:48397 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752325AbeAONxJ (ORCPT ); Mon, 15 Jan 2018 08:53:09 -0500 X-Greylist: delayed 695 seconds by postgrey-1.27 at vger.kernel.org; Mon, 15 Jan 2018 08:53:09 EST Subject: Re: [PATCH v7 4/8] can: m_can: Move allocation of net device to probe To: Faiz Abbas , wg@grandegger.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, nsekhar@ti.com, fcooper@ti.com, robh@kernel.org, Wenyou.Yang@microchip.com, sergei.shtylyov@cogentembedded.com, linux-omap@vger.kernel.org, b29396@freescale.com References: <1515581725-29242-1-git-send-email-faiz_abbas@ti.com> <1515581725-29242-5-git-send-email-faiz_abbas@ti.com> From: Marc Kleine-Budde Message-ID: <480602fa-db66-d5c3-056c-e61e5d0f2afa@pengutronix.de> Date: Mon, 15 Jan 2018 14:52:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1515581725-29242-5-git-send-email-faiz_abbas@ti.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="akSF5ruHBbcT5gKyb02X5q7S53CezsxV5" X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --akSF5ruHBbcT5gKyb02X5q7S53CezsxV5 Content-Type: multipart/mixed; boundary="fXzetqdQFUxgwEebKAG2vX8pQTe08WApW"; protected-headers="v1" From: Marc Kleine-Budde To: Faiz Abbas , wg@grandegger.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, nsekhar@ti.com, fcooper@ti.com, robh@kernel.org, Wenyou.Yang@microchip.com, sergei.shtylyov@cogentembedded.com, linux-omap@vger.kernel.org, b29396@freescale.com Message-ID: <480602fa-db66-d5c3-056c-e61e5d0f2afa@pengutronix.de> Subject: Re: [PATCH v7 4/8] can: m_can: Move allocation of net device to probe References: <1515581725-29242-1-git-send-email-faiz_abbas@ti.com> <1515581725-29242-5-git-send-email-faiz_abbas@ti.com> In-Reply-To: <1515581725-29242-5-git-send-email-faiz_abbas@ti.com> --fXzetqdQFUxgwEebKAG2vX8pQTe08WApW Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable On 01/10/2018 11:55 AM, Faiz Abbas wrote: > With the version no longer required to allocate the net device, it can > be moved to probe and the alloc_m_can_dev() function can be simplified.= >=20 > Therefore, move the allocation of net device to probe and change > alloc_m_can_dev() to setup_m_can_dev(). The error handling is broken with this patch, Have a look at the switch (priv->version) in setup_m_can_dev(), you free the m_can_dev in case of error, but exit with -EINVAL in the beginning of the function. setup_m_can_dev() should not free if it doesn't allocate= =2E The error handling in m_can_plat_probe() is broken, too. If pm_runtime_get_sync(&pdev->dev) fails, you don't free the candev. Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | --fXzetqdQFUxgwEebKAG2vX8pQTe08WApW-- --akSF5ruHBbcT5gKyb02X5q7S53CezsxV5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEE4bay/IylYqM/npjQHv7KIOw4HPYFAlpcsiMACgkQHv7KIOw4 HPapVggAhxFcJN45S8L15Q5gq5GFHKDUqlHAHfH9J5f7VvfyVBRyejJVduT+UX27 vgSoGnPaqb5VENFSytlrEwVIWEu1d81m4y58wtdJo2yo0MW3A/ln0QDd+cIVP4CJ q9Yfmc2o0/Cb2oNojxjNQWPPAHkc1S20o9TLFoStGOk+Fe2Un32bg7iLfPWAx1z6 yqsceEu8aidvt9WenHttxuS2KJHp9XyCVVwMCyDDL5vLMwl78HH2NkZR+u3uLzqy Z0vwgTVrEGocrDwREVsuFESO9LcTSlRtVYo1kz0PdAMY+liCXwNDYGyi1zyLiNfy ncS8Rrd2XTgHf0mTYElLWusWCHBdkg== =eFGr -----END PGP SIGNATURE----- --akSF5ruHBbcT5gKyb02X5q7S53CezsxV5--