> @@ -646,22 +646,19 @@ static int i2c_bfin_twi_probe(struct platform_device 
> *pdev)
>       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>       if (res == NULL) {
>               dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");
> -             rc = -ENOENT;
> -             goto out_error_get_res;
> +             return -ENOENT;

You don't need to check the resource. devm_ioremap_resource will do it.

> -     iface->regs_base = ioremap(res->start, resource_size(res));
> -     if (iface->regs_base == NULL) {
> +     iface->regs_base = devm_ioremap_resource(&pdev->dev, res);
> +     if (IS_ERR((void *)iface->regs_base)) {
>               dev_err(&pdev->dev, "Cannot map IO\n");
> -             rc = -ENXIO;
> -             goto out_error_ioremap;
> +             return PTR_ERR((void *)iface->regs_base);

Do we need the casts?

> @@ -740,8 +728,6 @@ static int i2c_bfin_twi_remove(struct platform_device 
> *pdev)
>       i2c_del_adapter(&(iface->adap));
>       free_irq(iface->irq, iface);
>       peripheral_free_list(dev_get_platdata(&pdev->dev));
> -     iounmap(iface->regs_base);
> -     kfree(iface);

You missed to remove the free irq.

Have you actually tried unloading the module?

Attachment: signature.asc
Description: Digital signature

Reply via email to