public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: qcom: common: check for failure
Date: Thu, 3 Dec 2015 14:12:34 +0530	[thread overview]
Message-ID: <20151203084234.GA5724@sudip-pc> (raw)
In-Reply-To: <20151203073917.GE14699@codeaurora.org>

On Wed, Dec 02, 2015 at 11:39:17PM -0800, Stephen Boyd wrote:
> On 12/01, Sudip Mukherjee wrote:
> > We were not checking the return from devm_add_action() which can fail.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> >  drivers/clk/qcom/common.c | 13 ++++++++++---
> >  1 file changed, 10 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
> > index c112eba..3541a9a 100644
> > --- a/drivers/clk/qcom/common.c
> > +++ b/drivers/clk/qcom/common.c
> > @@ -213,7 +213,10 @@ int qcom_cc_really_probe(struct platform_device *pdev,
> >  	if (ret)
> >  		return ret;
> >  
> > -	devm_add_action(dev, qcom_cc_del_clk_provider, pdev->dev.of_node);
> > +	ret = devm_add_action(dev, qcom_cc_del_clk_provider,
> > +			      pdev->dev.of_node);
> > +	if (ret)
> > +		return ret;
> 
> So now we don't remove the clk provider on allocation failure?
> Confused.
> 
> >  
> >  	reset = &cc->reset;
> >  	reset->rcdev.of_node = dev->of_node;
> > @@ -236,8 +239,12 @@ int qcom_cc_really_probe(struct platform_device *pdev,
> >  			return ret;
> >  	}
> >  
> > -	devm_add_action(dev, qcom_cc_gdsc_unregister, dev);
> > -
> > +	ret = devm_add_action(dev, qcom_cc_gdsc_unregister, dev);
> > +	if (ret) {
> > +		if (desc->gdscs && desc->num_gdscs)
> > +			gdsc_unregister(dev);
> > +		return ret;
> > +	}
> >  
> >  	return 0;
> >  }
> 
> You seem to have missed the reset devm action. Why?

I have messed up pretty bad in this patch. :(
> 
> Also, I wonder if we could have devm_add_action() or some other
> new devm_add_action() wrapper that tried to add the action, and
> if it failed it ran the action right there and returned the
> -ENOMEM? So then we can just have:
> 
> 	ret = devm_add_action_or_do_it(dev, qcom_cc_gdsc_unregister, dev)
> 	if (ret)
> 		return ret;
> 
> and we're assured that on the failure path we'll have already
> called qcom_cc_gdsc_unregister.

I am on it, will send you a patch for this.

regards
sudip

      reply	other threads:[~2015-12-03  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01  9:06 [PATCH] clk: qcom: common: check for failure Sudip Mukherjee
2015-12-03  7:39 ` Stephen Boyd
2015-12-03  8:42   ` Sudip Mukherjee [this message]

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=20151203084234.GA5724@sudip-pc \
    --to=sudipm.mukherjee@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.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