linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: fix function name in devm_clk_put kernel-doc comment
Date: Mon, 23 Sep 2013 17:28:24 +0100	[thread overview]
Message-ID: <20130923162824.GV12758@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1379951159-8294-1-git-send-email-u.kleine-koenig@pengutronix.de>

On Mon, Sep 23, 2013 at 05:45:59PM +0200, Uwe Kleine-K?nig wrote:
> The paragraph about clk_put already specifies this restriction about
> clk_put.
> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> I suspect that devm_clk_put is used more often than necessary. After some
> grepping around e.g. looking at drivers/tty/serial/clps711x.c it doesn't
> seem necessary to call it as the driver core already cares about calling
> the devm cleanup callbacks.

The one(s) you've left are in drivers/media/platform/marvell-ccic/mmp-driver.c:

static void mcam_deinit_clk(struct mcam_camera *mcam)
{
        unsigned int i;

        for (i = 0; i < NR_MCAM_CLK; i++) {
                if (!IS_ERR(mcam->clk[i])) {
                        if (mcam->clk[i])
                                devm_clk_put(mcam->dev, mcam->clk[i]);
                }
                mcam->clk[i] = NULL;
        }
}

static int mmpcam_probe(struct platform_device *pdev)
{
        cam = devm_kzalloc(&pdev->dev, sizeof(*cam), GFP_KERNEL);
...
        mcam = &cam->mcam;
...
        mcam->regs = devm_ioremap_resource(&pdev->dev, res);
...
        cam->power_regs = devm_ioremap_resource(&pdev->dev, res);
...
out_unregister:
        mccic_shutdown(mcam);
out_power_down:
        mmpcam_power_down(mcam);
out_deinit_clk:
        mcam_deinit_clk(mcam);
        return ret;
}

static int mmpcam_remove(struct mmp_camera *cam)
{
...
        mcam_deinit_clk(mcam);
        iounmap(cam->power_regs);
        iounmap(mcam->regs);
        kfree(cam);
        return 0;
}

So, mcam_deinit_clk() provides nothing useful and should be killed.

Second thing to spot from the above is that kfree() is broken.  As
are those iounmap()s.  The more I look at this, the more I find wrong.
gpio_free() too.

Quite honestly, I think this driver is quite broken as it stands -
anything you do to it (even patching it without build testing) is
IMHO likely to improve this driver!

  parent reply	other threads:[~2013-09-23 16:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23 15:45 [PATCH] clk: fix function name in devm_clk_put kernel-doc comment Uwe Kleine-König
2013-09-23 15:53 ` [PATCH] serial: clps711x: drop needless devm_clk_put Uwe Kleine-König
2013-09-23 16:00 ` [PATCH] remoteproc/davinci: " Uwe Kleine-König
2014-02-24 15:07   ` Ohad Ben-Cohen
2013-09-23 16:13 ` [PATCH] video: mmp: drop needless devm cleanup Uwe Kleine-König
2013-09-23 16:19   ` Russell King - ARM Linux
2013-09-24  7:34     ` Tomi Valkeinen
2013-09-24  7:55       ` Zhou Zhu
2013-09-26  8:43   ` Tomi Valkeinen
2013-09-23 16:28 ` Russell King - ARM Linux [this message]
2013-09-24 18:12 ` [PATCH] ASoC: kirkwood: simplify clock handling Uwe Kleine-König
2013-09-24 18:38   ` Russell King - ARM Linux
2013-09-24 19:04   ` Jean-Francois Moine
2013-09-24 19:05     ` Russell King - ARM Linux
2013-09-24 19:24       ` Uwe Kleine-König
2013-09-24 18:42 ` [PATCH] [media] marvell-ccic: simplify and fix clk handling (a bit) Uwe Kleine-König
2013-09-24 18:59   ` [PATCH v2] " Uwe Kleine-König
2013-09-25  7:15     ` Jonathan Corbet
2013-09-26  2:47       ` Libin Yang
2013-09-26  8:13         ` Uwe Kleine-König
2013-09-26  8:24           ` Russell King - ARM Linux
2013-09-26 10:08             ` Libin Yang
2013-09-26 10:03           ` Libin Yang
2013-09-24 19:20 ` [PATCH] [RFC] devm: drop devm_clk_put Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130923162824.GV12758@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).