Re: [PATCH 04/14] memstick: core: fix device_register() error handling

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

 



On Wed, Sep 22, 2010 at 00:49, Greg KH <greg@xxxxxxxxx> wrote:

> Âint device_register(struct device *dev)
> Â{
> + Â Â Â int retval;
> +
> Â Â Â Âdevice_initialize(dev);
> - Â Â Â return device_add(dev);
> + Â Â Â retval = device_add(dev);
> + Â Â Â if (retval)
> + Â Â Â Â Â Â Â put_device(dev);
> + Â Â Â return retval;
> Â}

> Kay, what am I missing here, why can't we just do this? ÂHm, the
> side-affect might be that if device_register() fails, NO ONE had better
> touch that device again, as it might have just been freed from the
> system. ÂI wonder if that will cause problems...

That looks right, besides that there might be callers already doing
this. Which needs to be checked.

I never liked this pretty useless "convenience API", which just wraps
two simple functions and the first one can never fail anyway.

We better remove that device_register() stuff entirely in the long
run, it's not doing any good. At the kobject level we killed the same
stuff already long ago.

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


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux