i2c: mv64xxx: Fix check for missing clock after adding RPM
authorSamuel Holland <samuel@sholland.org>
Mon, 8 Feb 2021 06:19:22 +0000 (00:19 -0600)
committerWolfram Sang <wsa@kernel.org>
Tue, 9 Feb 2021 10:41:59 +0000 (11:41 +0100)
In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
pointers to optional clocks were replaced by NULL to simplify the resume
callback implementation. However, that commit missed that the IS_ERR
check in mv64xxx_of_config should be replaced with a NULL check. As a
result, the check always passes, even for an invalid device tree.

Fixes: e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-mv64xxx.c

index b03c344323d159fa376b15a362ac62614e7bda16..c590d36b5fd165134ccf20a0a785f237c939f363 100644 (file)
@@ -813,7 +813,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
         * need to know tclk in order to calculate bus clock
         * factors.
         */
-       if (IS_ERR(drv_data->clk)) {
+       if (!drv_data->clk) {
                rc = -ENODEV;
                goto out;
        }