C++ (Cpp) IS_ERR Examples

C++ (Cpp) IS_ERR - 30 examples found. These are the top rated real world C++ (Cpp) examples of IS_ERR extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
int sensors_register(struct device *dev, void * drvdata, struct device_attribute *attributes[], char *name)
{
    int ret = 0;

    if(!sensors_class)
    {
        sensors_class = class_create(THIS_MODULE, "sensors");
        if(IS_ERR(sensors_class))
            return PTR_ERR(sensors_class);
    }

    mutex_lock(&sensors_mutex);

    dev = device_create(sensors_class, NULL, 0, drvdata, "%s", name);

    if (IS_ERR(dev)) {
        ret = PTR_ERR(dev);
        printk(KERN_ERR "[SENSORS CORE] device_create failed! [%d]\n", ret);
        return ret;
    }

    set_sensor_attr(dev, attributes);

    atomic_inc(&sensor_count);

    mutex_unlock(&sensors_mutex);

    return 0;
}
Example #2
0
static int macallan_dsi_regulator_get(struct device *dev)
{
    int err = 0;

    if (reg_requested)
        return 0;

    avdd_lcd_3v3 = regulator_get(dev, "avdd_lcd");
    if (IS_ERR(avdd_lcd_3v3)) {
        pr_err("avdd_lcd regulator get failed\n");
        err = PTR_ERR(avdd_lcd_3v3);
        avdd_lcd_3v3 = NULL;
        goto fail;
    }

    vdd_lcd_bl_en = regulator_get(dev, "vdd_lcd_bl_en");
    if (IS_ERR(vdd_lcd_bl_en)) {
        pr_err("vdd_lcd_bl_en regulator get failed\n");
        err = PTR_ERR(vdd_lcd_bl_en);
        vdd_lcd_bl_en = NULL;
        goto fail;
    }
    reg_requested = true;
    return 0;
fail:
    return err;
}
static int spear1340_miphy_probe(struct platform_device *pdev)
{
    struct device *dev = &pdev->dev;
    struct spear1340_miphy_priv *priv;
    struct phy_provider *phy_provider;

    priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
    if (!priv)
        return -ENOMEM;

    priv->misc =
        syscon_regmap_lookup_by_phandle(dev->of_node, "misc");
    if (IS_ERR(priv->misc)) {
        dev_err(dev, "failed to find misc regmap\n");
        return PTR_ERR(priv->misc);
    }

    priv->phy = devm_phy_create(dev, NULL, &spear1340_miphy_ops);
    if (IS_ERR(priv->phy)) {
        dev_err(dev, "failed to create SATA PCIe PHY\n");
        return PTR_ERR(priv->phy);
    }

    dev_set_drvdata(dev, priv);
    phy_set_drvdata(priv->phy, priv);

    phy_provider =
        devm_of_phy_provider_register(dev, spear1340_miphy_xlate);
    if (IS_ERR(phy_provider)) {
        dev_err(dev, "failed to register phy provider\n");
        return PTR_ERR(phy_provider);
    }

    return 0;
}
Example #4
0
static int __init mddi_driver_init(void)
{
    int ret;

    mddi_clk = clk_get(NULL, "mddi_clk");
    if (IS_ERR(mddi_clk)) {
        printk(KERN_ERR "can't find mddi_clk \n");
        return PTR_ERR(mddi_clk);
    }

    mddi_pclk = clk_get(NULL, "mddi_pclk");
    if (IS_ERR(mddi_pclk))
        mddi_pclk = NULL;
    pmdh_clk_enable();
    ret = mddi_register_driver();
    if (ret) {
        pmdh_clk_disable();
        clk_put(mddi_clk);
        if (mddi_pclk) {
            clk_put(mddi_pclk);
        }
        printk(KERN_ERR "mddi_register_driver() failed!\n");
        return ret;
    }

    mddi_init();

    return ret;
}
Example #5
0
int usbip_start_threads(struct usbip_device *ud)
{
    /*
     * threads are invoked per one device (per one connection).
     */
    struct task_struct *th;

    th = kthread_run(usbip_thread, (void *)&ud->tcp_rx, "usbip");
    if (IS_ERR(th)) {
        printk(KERN_WARNING
               "Unable to start control thread\n");
        return PTR_ERR(th);
    }
    th = kthread_run(usbip_thread, (void *)&ud->tcp_tx, "usbip");
    if (IS_ERR(th)) {
        printk(KERN_WARNING
               "Unable to start control thread\n");
        return PTR_ERR(th);
    }

    /* confirm threads are starting */
    wait_for_completion(&ud->tcp_rx.thread_done);
    wait_for_completion(&ud->tcp_tx.thread_done);
    return 0;
}
Example #6
0
static struct dentry *logfs_lookup(struct inode *dir, struct dentry *dentry,
                                   struct nameidata *nd)
{
    struct page *page;
    struct logfs_disk_dentry *dd;
    pgoff_t index;
    u64 ino = 0;
    struct inode *inode;

    page = logfs_get_dd_page(dir, dentry);
    if (IS_ERR(page))
        return ERR_CAST(page);
    if (!page) {
        d_add(dentry, NULL);
        return NULL;
    }
    index = page->index;
    dd = kmap_atomic(page);
    ino = be64_to_cpu(dd->ino);
    kunmap_atomic(dd);
    page_cache_release(page);

    inode = logfs_iget(dir->i_sb, ino);
    if (IS_ERR(inode))
        printk(KERN_ERR"LogFS: Cannot read inode #%llx for dentry (%lx, %lx)n",
				ino, dir->i_ino, index);
	return d_splice_alias(inode, dentry);
}