]> git.baikalelectronics.ru Git - kernel.git/commit
device-dax: fix 'passing zero to ERR_PTR()' warning
authorDan Williams <dan.j.williams@intel.com>
Wed, 12 Jul 2017 20:42:37 +0000 (13:42 -0700)
committerDan Williams <dan.j.williams@intel.com>
Mon, 17 Jul 2017 18:43:58 +0000 (11:43 -0700)
commit335aefd1fe2b419a1dc4fd3bf955003bdac457ac
treecf27724a7c3a0c200e167068d1e2346dedbc5c52
parentc34e44bad1a4cbaf5a426bce3fdf6394fd5989b9
device-dax: fix 'passing zero to ERR_PTR()' warning

Dan Carpenter reports:

    The patch 873d92e6523e: "dax: refactor dax-fs into a generic provider
    of 'struct dax_device' instances" from Apr 11, 2017, leads to the
    following static checker warning:

        drivers/dax/device.c:643 devm_create_dev_dax()
        warn: passing zero to 'ERR_PTR'

Fix the case where we inadvertently leak 0 to ERR_PTR() by setting at
every error case, and make it clear that 'count' is never 0.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/dax/device.c