Skip to content

Commit 9aeacd2

Browse files
Dan Carpentergregkh
authored andcommitted
mux: mmio: Fix IS_ERR() vs NULL check in probe()
The devm_kmalloc() function never returns error pointers, it returns NULL on error. Fix the error checking. Fixes: 4863cb2 ("mux: mmio: Add suspend and resume support") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/aSsIP7oKrhKfCUv3@stanley.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0ea4cc9 commit 9aeacd2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/mux/mmio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ static int mux_mmio_probe(struct platform_device *pdev)
101101
mux_mmio = mux_chip_priv(mux_chip);
102102

103103
mux_mmio->fields = devm_kmalloc(dev, num_fields * sizeof(*mux_mmio->fields), GFP_KERNEL);
104-
if (IS_ERR(mux_mmio->fields))
105-
return PTR_ERR(mux_mmio->fields);
104+
if (!mux_mmio->fields)
105+
return -ENOMEM;
106106

107107
mux_mmio->hardware_states = devm_kmalloc(dev, num_fields *
108108
sizeof(*mux_mmio->hardware_states), GFP_KERNEL);
109-
if (IS_ERR(mux_mmio->hardware_states))
110-
return PTR_ERR(mux_mmio->hardware_states);
109+
if (!mux_mmio->hardware_states)
110+
return -ENOMEM;
111111

112112
for (i = 0; i < num_fields; i++) {
113113
struct mux_control *mux = &mux_chip->mux[i];

0 commit comments

Comments
 (0)