Commit 9aeacd2f authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

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: 4863cb2b ("mux: mmio: Add suspend and resume support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/aSsIP7oKrhKfCUv3@stanley.mountain


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ea4cc93
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -101,13 +101,13 @@ static int mux_mmio_probe(struct platform_device *pdev)
	mux_mmio = mux_chip_priv(mux_chip);

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

	mux_mmio->hardware_states = devm_kmalloc(dev, num_fields *
						 sizeof(*mux_mmio->hardware_states), GFP_KERNEL);
	if (IS_ERR(mux_mmio->hardware_states))
		return PTR_ERR(mux_mmio->hardware_states);
	if (!mux_mmio->hardware_states)
		return -ENOMEM;

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