From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751110AbeAPJCt (ORCPT + 1 other); Tue, 16 Jan 2018 04:02:49 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:59744 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbeAPJCo (ORCPT ); Tue, 16 Jan 2018 04:02:44 -0500 Subject: Re: [PATCH v7 4/8] can: m_can: Move allocation of net device to probe To: Marc Kleine-Budde , , , CC: , , , , , , , , , , References: <1515581725-29242-1-git-send-email-faiz_abbas@ti.com> <1515581725-29242-5-git-send-email-faiz_abbas@ti.com> <480602fa-db66-d5c3-056c-e61e5d0f2afa@pengutronix.de> From: Faiz Abbas Message-ID: <811c146c-7269-fb70-30bb-f60159473f02@ti.com> Date: Tue, 16 Jan 2018 14:33:08 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <480602fa-db66-d5c3-056c-e61e5d0f2afa@pengutronix.de> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi, On Monday 15 January 2018 07:22 PM, Marc Kleine-Budde wrote: > 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. >> >> 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. > > 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. > Will fix. Thanks, Faiz