Skip to content

Commit 2bc2129

Browse files
sjp38dbaluta
authored andcommitted
Documentation/device_model: Fix wrong 'match()' example
'match()' should return non-zero for match success, but the example in the document is returning non-zero for match failures. This commit fixes it. Signed-off-by: SeongJae Park <sj38.park@gmail.com>
1 parent 872b4e0 commit 2bc2129

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Documentation/teaching/labs/device_model.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ The functions that will normally be initialized within a bus_type structure are
331331
// match devices to drivers; just do a simple name test
332332
static int my_match(struct device *dev, struct device_driver *driver)
333333
{
334-
return strncmp(dev_name(dev), driver->name, strlen(driver->name));
334+
return !strncmp(dev_name(dev), driver->name, strlen(driver->name));
335335
}
336336
337337
// respond to hotplug user events; add environment variable DEV_NAME

0 commit comments

Comments
 (0)