drivers: media: platform/meson: does there exist a refcount error in function meson_ao_cec_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,all:
when reviewing code of function meson_ao_cec_probe:
In Linux kernel version before v5.4, function meson_ao_cec_probe hold
a notify  reference by cec_notifier_get, when err happens, it will
release notify
twice by cec_notifier_put, does here exist a redundant put in error
handling of cec_register_adapter return value?

static int meson_ao_cec_probe(struct platform_device *pdev)
{
    ao_cec->notify = cec_notifier_get(hdmi_dev);
    if (!ao_cec->notify)
        return -ENOMEM;

    ......

    ret = clk_set_rate (ao_cec->core, CEC_CLK_RATE);
    if (ret) {
        dev_err(&pdev->dev, "core clock set rate failed\n");
        goto out_probe_clk;
    }

    device_reset_optional(&pdev->dev);

    ao_cec->pdev = pdev;
    platform_set_drvdata(pdev, ao_cec);

    ret = cec_register_adapter(ao_cec->adap, &pdev->dev);
    if (ret < 0) {
        cec_notifier_put(ao_cec->notify);     // is it a redundant put here?
        goto out_probe_clk;
    }


    out_probe_clk:
        clk_disable_unprepare(ao_cec->core);

    out_probe_adapter:
        cec_delete_adapter(ao_cec->adap);

    out_probe_notify:
        cec_notifier_put(ao_cec->notify);

    dev_err(&pdev->dev, "CEC controller registration failed\n");

    return ret;
}




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux