RE: [PATCH v1 2/3] OMAP4: Ethernet: KS8851 Board Support

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

 



> > > > +
> > > > +static void omap_ethernet_init(void)
> > > > +{
> > > > +	gpio_request(ETHERNET_KS8851_POWER_ENABLE, "ethernet");
> > > > +	gpio_direction_output(ETHERNET_KS8851_POWER_ENABLE, 1);
> > > > +	gpio_request(ETHERNET_KS8851_QUART, "quart");
> > > > +	gpio_direction_output(ETHERNET_KS8851_QUART, 1);
> > > > +	gpio_request(ETHERNET_KS8851_IRQ, "ks8851");
> > >
> > > Any reason for not checking return value of gpio_request()?
> > >
> >
> > Thought initially about them as dedicated lines for ethernet avoiding
> > both reasons to check for a gpio's request:
> >
> >  1. invalid gpio
> >  2. already claimed gpio
> 
> You still need to check for the result.
> 

Is the below approach ok? Using goto would make it better?

        int status;

        status = gpio_request(ETHERNET_KS8851_POWER_ENABLE, "ethernet");
        if (status < 0)
                return status;

        gpio_request(ETHERNET_KS8851_QUART, "quart");
        if (status < 0) {
                gpio_free(ETHERNET_KS8851_POWER_ENABLE);
                return status;
        }

        gpio_request(ETHERNET_KS8851_IRQ, "ks8851");
        if (status < 0) {
                gpio_free(ETHERNET_KS8851_POWER_ENABLE);
                gpio_free(ETHERNET_KS8851_QUART);
                return status;
        }

        gpio_direction_output(ETHERNET_KS8851_POWER_ENABLE, 1);
        gpio_direction_output(ETHERNET_KS8851_QUART, 1);
        gpio_direction_input(ETHERNET_KS8851_IRQ);

Best Regards
Abraham
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux