From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id CCAA71BFF7A for ; Mon, 14 May 2018 19:30:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C8D4186E56 for ; Mon, 14 May 2018 19:30:21 +0000 (UTC) Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zDTFGrQbBVw7 for ; Mon, 14 May 2018 19:30:21 +0000 (UTC) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id EC37F86E50 for ; Mon, 14 May 2018 19:30:20 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id a20-v6so2547754pfo.0 for ; Mon, 14 May 2018 12:30:20 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH 03/14] staging: clocking-wizard: Split probe function From: James Kelly In-Reply-To: <20180514134726.zdl46z46qe4thx7x@mwanda> Date: Tue, 15 May 2018 05:30:15 +1000 Message-Id: References: <20180507012040.18187-1-jamespeterkelly@gmail.com> <20180507012040.18187-4-jamespeterkelly@gmail.com> <20180514134726.zdl46z46qe4thx7x@mwanda> List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: Dan Carpenter Cc: Greg Kroah-Hartman , driverdev-devel@linuxdriverproject.org, Michal Simek Dan, > On 14 May 2018, at 11:47 pm, Dan Carpenter wrote: > > On Mon, May 07, 2018 at 11:20:29AM +1000, James Kelly wrote: >> +static int clk_wzrd_probe(struct platform_device *pdev) >> +{ >> + int ret; >> + struct device *dev = &pdev->dev; >> + >> + ret = clk_wzrd_get_device_tree_data(dev); >> + if (ret) >> + return ret; >> + >> + ret = clk_wzrd_regmap_alloc(dev); >> + if (ret) >> + return ret; >> + >> + ret = clk_wzrd_register_ccf(dev); >> + if (ret) >> + return ret; >> + >> + return 0; > > The error handling is a terrible layer violation now... Every > allocation function should have a matching free function. But now > instead of that if clk_wzrd_register_ccf() fails then it starts cleaning > up the clk_wzrd->axi_clk that was allocated in > clk_wzrd_get_device_tree_data(). > > regards, > dan carpenter > > This gets cleaned up in patch 6. There seemed little point in putting a whole lot of code in patch 3 only to rip it out again in patch 6. I was trying to keep the patches simple. I could defer breaking up the probe function until after the changes in patch 6 ? James _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel