diff --git a/drivers/gpio/qpnp-pin.c b/drivers/gpio/qpnp-pin.c index 64341e9ae12..ed001f0ee38 100644 --- a/drivers/gpio/qpnp-pin.c +++ b/drivers/gpio/qpnp-pin.c @@ -589,6 +589,9 @@ int qpnp_pin_config(int gpio, struct qpnp_pin_cfg *param) } mutex_unlock(&qpnp_pin_chips_lock); + if (!q_spec) + return -ENODEV; + rc = _qpnp_pin_config(q_chip, q_spec, param); return rc; @@ -1225,6 +1228,8 @@ static int qpnp_pin_probe(struct spmi_device *spmi) if (!res) { dev_err(&spmi->dev, "%s: node %s is missing has no base address definition\n", __func__, d_node->of_node->full_name); + rc = -EINVAL; + goto err_probe; } rc = of_property_read_u32(d_node->of_node, diff --git a/drivers/spmi/qpnp-int.c b/drivers/spmi/qpnp-int.c index 8c814ea157b..8fd41ebbcef 100644 --- a/drivers/spmi/qpnp-int.c +++ b/drivers/spmi/qpnp-int.c @@ -576,11 +576,14 @@ int qpnpint_handle_irq(struct spmi_controller *spmi_ctrl, unsigned long hwirq, busno; int irq; + if (!spec || !spmi_ctrl) + return -EINVAL; + pr_debug("spec slave = %u per = %u irq = %u\n", spec->slave, spec->per, spec->irq); busno = spmi_ctrl->nr; - if (!spec || !spmi_ctrl || busno >= QPNPINT_MAX_BUSSES) + if (busno >= QPNPINT_MAX_BUSSES) return -EINVAL; hwirq = qpnpint_encode_hwirq(spec);