All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 1/2] i8k: Integrate with the hwmon subsystem
Date: Fri, 15 Apr 2011 11:20:12 +0000	[thread overview]
Message-ID: <20110415112012.GB23594@ericsson.com> (raw)
In-Reply-To: <20110413172856.06682baf@endymion.delvare>

Hi Jean,

On Fri, Apr 15, 2011 at 03:37:58AM -0400, Jean Delvare wrote:
> Hi Guenter,
> 
> Thanks for the review.
> 
> On Thu, 14 Apr 2011 11:41:47 -0700, Guenter Roeck wrote:
> > On Wed, 2011-04-13 at 11:28 -0400, Jean Delvare wrote:
> > > @@ -590,6 +732,11 @@ static int __init i8k_init(void)
> > >  	if (!proc_i8k)
> > >  		return -ENOENT;
> > >  
> > > +	if (i8k_init_hwmon()) {
> > > +		remove_proc_entry("i8k", NULL);
> > > +		return -ENODEV;
> > > +	}
> > > +
> > Should that be something like
> > 	err = i8k_init_hwmon();
> > 	if (err)
> > 		goto remove_proc;
> > 
> > 	...
> > 
> > remove_proc:
> > 	remove_proc_entry("i8k", NULL);
> > 	return err;
> 
> I would have done exactly this if it were my driver. However I noticed
> that the error code from i8k_probe() is not preserved, so I decided to
> follow the same logic for consistency.
> 
Both are independent of each other. If a rule is not followed at one place 
it doesn't mean that it should not be followed elsewhere. Besides, my main point
was to follow the one-function-exit rule; retaining the error code was a side
effect as 

	err = i8k_init_hwmon();
	if (err) {
		err = -ENODEV;
		goto remove_proc;
	}

didn't seem to make much sense.

Is there a generic rule that error codes shall be retained ? I looked for it,
but did not find it. If not I should add it to the hwmon driver guidelines.

> If you think this is a blocker, then I'll write a preliminary patch to
> preserve the error code returned by i8k_probe(), and then update my own
> patch in the way you suggested above.
> 
I'll leave it up to you. 

Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>

for both patches.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2011-04-15 11:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 15:28 [lm-sensors] [PATCH 1/2] i8k: Integrate with the hwmon subsystem Jean Delvare
2011-04-14 18:41 ` Guenter Roeck
2011-04-15  7:37 ` Jean Delvare
2011-04-15 11:20 ` Guenter Roeck [this message]
2011-04-16  8:20 ` Jean Delvare

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=20110415112012.GB23594@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=lm-sensors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.