Re: [PATCH v2] hwmon: (ads7871) Fix ads7871_probe error path

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jean Delvare
Date: Sunday, August 22, 2010 - 4:58 am

Axel, Paul,

On Tue, 17 Aug 2010 16:10:48 +0200, Jean Delvare wrote:

Hmm, looking at the code again as I was about to send the patch to
Linus, it seems that the above fix isn't sufficient. One problem is
that it makes little sense to create sysfs attributes for the device if
the probe is going to fail. So sysfs file creation should be delayed
until after the device presence check. A second, more important problem
is that no error code is returned if sysfs_create_group() fails. The
probe function will return success (0) while the device is not
registered, which means trouble when the remove function is called
later.

The second problem is caused by the presence of two local variables
carrying error values: err and status. The latter should be dropped to
avoid the confusion, and the former shouldn't be initialized to 0, so
that the compiler has a chance to warn about such issues.

Axel, Paul, can either of you please send an updated patch as a
replacement for this one, fixing the two remaining issues? Thanks.

As a side note, I also noticed that struct ads7871_data has an unused
member "update_lock". Someone familiar with the device and driver
should check whether it should be used somewhere, or if it can be
dropped.

-- 
Jean Delvare
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH v2] hwmon: (ads7871) Fix ads7871_probe error path, Jean Delvare, (Sun Aug 22, 4:58 am)