drm: rcar-du: Clarify error message when encoder initialization fails
Dan Carpenter
dan.carpenter at oracle.com
Fri Jun 26 02:47:54 PDT 2015
Hello Laurent Pinchart,
This is a semi-automatic email about new static checker warnings.
The patch 64549cdf85a1: "drm: rcar-du: Clarify error message when
encoder initialization fails" from May 26, 2015, leads to the
following Smatch complaint:
drivers/gpu/drm/rcar-du/rcar_du_kms.c:651 rcar_du_encoders_init_one()
error: we previously assumed 'encoder' could be null (see line 613)
drivers/gpu/drm/rcar-du/rcar_du_kms.c
612
613 if (encoder) {
^^^^^^^
Check for NULL.
614 /*
615 * If an encoder has been found, get its type based on its
616 * compatible string.
617 */
618 unsigned int i;
619
620 for (i = 0; i < ARRAY_SIZE(encoders); ++i) {
621 if (of_device_is_compatible(encoder,
622 encoders[i].compatible)) {
623 enc_type = encoders[i].type;
624 break;
625 }
626 }
627
628 if (i == ARRAY_SIZE(encoders)) {
629 dev_warn(rcdu->dev,
630 "unknown encoder type for %s, skipping\n",
631 encoder->full_name);
632 of_node_put(encoder);
633 of_node_put(connector);
634 return -EINVAL;
635 }
636 } else {
637 /*
638 * If no encoder has been found the entity must be the
639 * connector.
640 */
641 connector = entity;
642 }
643
644 ret = rcar_du_encoder_init(rcdu, enc_type, output, encoder, connector);
645 of_node_put(encoder);
^^^^^^^
Free?
646 of_node_put(connector);
647
648 if (ret && ret != -EPROBE_DEFER)
649 dev_warn(rcdu->dev,
650 "failed to initialize encoder %s (%d), skipping\n",
651 encoder->full_name, ret);
^^^^^^^^^^^^^^^^^^
Unchecked dereference.
652
653 return ret;
regards,
dan carpenter
More information about the dri-devel
mailing list