Message ID | 1428492040-5581-3-git-send-email-sudipm.mukherjee@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello. On 4/8/2015 2:20 PM, Sudip Mukherjee wrote: > now that we are monitoring the return value from attach, make the So you've first changed the method prototype and follow up with the changes to the actual implementations? That's backward. I'm afraid such changes can't be done piecemeal. > required changes to return proper value from its attach function. > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > --- > sound/drivers/portman2x4.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c > index 464385a..866adbb 100644 > --- a/sound/drivers/portman2x4.c > +++ b/sound/drivers/portman2x4.c > @@ -672,32 +672,37 @@ static int snd_portman_probe_port(struct parport *p) > return res ? -EIO : 0; > } > > -static void snd_portman_attach(struct parport *p) > +static int snd_portman_attach(struct parport *p) > { > struct platform_device *device; > + int ret; > > device = platform_device_alloc(PLATFORM_DRIVER, device_count); > if (!device) > - return; > + return -ENOMEM; > > /* Temporary assignment to forward the parport */ > platform_set_drvdata(device, p); > > - if (platform_device_add(device) < 0) { > + ret = platform_device_add(device); > + I don't think empty line is needed here. > + if (ret < 0) { > platform_device_put(device); > - return; > + return ret; > } > [...] WBR, Sergei
On Wed, Apr 08, 2015 at 04:32:57PM +0300, Sergei Shtylyov wrote: > Hello. > > On 4/8/2015 2:20 PM, Sudip Mukherjee wrote: > > >now that we are monitoring the return value from attach, make the > > So you've first changed the method prototype and follow up with > the changes to the actual implementations? That's backward. I'm > afraid such changes can't be done piecemeal. Dan Carpenter has exlained me the problem with this aproach. I have already sent a v2 which doesnot break anything and if everyone approves that way then we can change one driver at a time and nothing will break. regards sudip >
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index 464385a..866adbb 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c @@ -672,32 +672,37 @@ static int snd_portman_probe_port(struct parport *p) return res ? -EIO : 0; } -static void snd_portman_attach(struct parport *p) +static int snd_portman_attach(struct parport *p) { struct platform_device *device; + int ret; device = platform_device_alloc(PLATFORM_DRIVER, device_count); if (!device) - return; + return -ENOMEM; /* Temporary assignment to forward the parport */ platform_set_drvdata(device, p); - if (platform_device_add(device) < 0) { + ret = platform_device_add(device); + + if (ret < 0) { platform_device_put(device); - return; + return ret; } /* Since we dont get the return value of probe * We need to check if device probing succeeded or not */ if (!platform_get_drvdata(device)) { platform_device_unregister(device); - return; + return -ENODEV; } /* register device in global table */ platform_devices[device_count] = device; device_count++; + + return 0; } static void snd_portman_detach(struct parport *p)
now that we are monitoring the return value from attach, make the required changes to return proper value from its attach function. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> --- sound/drivers/portman2x4.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)