From: Wolfram Sang <wsa@the-dreams.de> To: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jean Delvare <jdelvare@suse.de>, Rodolfo Giometti <giometti@enneenne.com>, "James E.J. Bottomley" <JBottomley@parallels.com>, Mark Brown <broonie@kernel.org>, Willy Tarreau <willy@meta-x.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, linux-spi@vger.kernel.org, devel@driverdev.osuosl.org, alsa-devel@alsa-project.org Subject: Re: [PATCH 12/14] i2c-parport: return proper error values from attach Date: Thu, 9 Apr 2015 09:13:07 +0200 [thread overview] Message-ID: <20150409071307.GA1166@katana> (raw) In-Reply-To: <1428492040-5581-13-git-send-email-sudipm.mukherjee@gmail.com> [-- Attachment #1: Type: text/plain, Size: 1834 bytes --] On Wed, Apr 08, 2015 at 04:50:38PM +0530, Sudip Mukherjee wrote: > 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> > --- > drivers/i2c/busses/i2c-parport.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c > index a1fac5a..761a775 100644 > --- a/drivers/i2c/busses/i2c-parport.c > +++ b/drivers/i2c/busses/i2c-parport.c > @@ -160,14 +160,14 @@ static void i2c_parport_irq(void *data) > "SMBus alert received but no ARA client!\n"); > } > > -static void i2c_parport_attach(struct parport *port) > +static int i2c_parport_attach(struct parport *port) > { > struct i2c_par *adapter; > > adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); > if (adapter == NULL) { > printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); > - return; > + return -ENOMEM; ENOMEM does not need printout. Please remove printk while we are here. > > pr_debug("i2c-parport: attaching to %s\n", port->name); > @@ -230,13 +230,14 @@ static void i2c_parport_attach(struct parport *port) > mutex_lock(&adapter_list_lock); > list_add_tail(&adapter->node, &adapter_list); > mutex_unlock(&adapter_list_lock); > - return; > + return 0; > > err_unregister: > parport_release(adapter->pdev); > parport_unregister_device(adapter->pdev); > err_free: > kfree(adapter); > + return -ENODEV; Ideally, we would return different -Esomething for each failing case. We can leave that for someone who is acutally using the driver. However, I wonder if ENODEV is a proper catch-all case because the driver core will not report failures. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> To: Sudip Mukherjee <sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>, Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>, Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>, Rodolfo Giometti <giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org>, "James E.J. Bottomley" <JBottomley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Willy Tarreau <willy-859RlTSWH48dnm+yROfE0A@public.gmane.org>, Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>, Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org Subject: Re: [PATCH 12/14] i2c-parport: return proper error values from attach Date: Thu, 9 Apr 2015 09:13:07 +0200 [thread overview] Message-ID: <20150409071307.GA1166@katana> (raw) In-Reply-To: <1428492040-5581-13-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [-- Attachment #1: Type: text/plain, Size: 1858 bytes --] On Wed, Apr 08, 2015 at 04:50:38PM +0530, Sudip Mukherjee wrote: > 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-ofJRbWXBVFamYgehrs7/Lw@public.gmane.org> > --- > drivers/i2c/busses/i2c-parport.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c > index a1fac5a..761a775 100644 > --- a/drivers/i2c/busses/i2c-parport.c > +++ b/drivers/i2c/busses/i2c-parport.c > @@ -160,14 +160,14 @@ static void i2c_parport_irq(void *data) > "SMBus alert received but no ARA client!\n"); > } > > -static void i2c_parport_attach(struct parport *port) > +static int i2c_parport_attach(struct parport *port) > { > struct i2c_par *adapter; > > adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); > if (adapter == NULL) { > printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); > - return; > + return -ENOMEM; ENOMEM does not need printout. Please remove printk while we are here. > > pr_debug("i2c-parport: attaching to %s\n", port->name); > @@ -230,13 +230,14 @@ static void i2c_parport_attach(struct parport *port) > mutex_lock(&adapter_list_lock); > list_add_tail(&adapter->node, &adapter_list); > mutex_unlock(&adapter_list_lock); > - return; > + return 0; > > err_unregister: > parport_release(adapter->pdev); > parport_unregister_device(adapter->pdev); > err_free: > kfree(adapter); > + return -ENODEV; Ideally, we would return different -Esomething for each failing case. We can leave that for someone who is acutally using the driver. However, I wonder if ENODEV is a proper catch-all case because the driver core will not report failures. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-04-09 7:12 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-04-08 11:20 [PATCH 00/14] parport: check success of attach call Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 01/14] parport: return value of attach and parport_register_driver Sudip Mukherjee 2015-04-08 11:38 ` Dan Carpenter 2015-04-08 11:38 ` Dan Carpenter 2015-04-08 11:44 ` Dan Carpenter 2015-04-08 11:44 ` Dan Carpenter 2015-04-08 12:14 ` Sudip Mukherjee 2015-04-08 12:14 ` Sudip Mukherjee 2015-04-08 11:50 ` Sudip Mukherjee 2015-04-08 11:50 ` Sudip Mukherjee 2015-04-08 12:27 ` Dan Carpenter 2015-04-08 12:27 ` Dan Carpenter 2015-04-08 17:56 ` Willy Tarreau 2015-04-08 17:56 ` Willy Tarreau 2015-04-08 11:20 ` [PATCH 02/14] ALSA: portman2x4: return proper error values from attach Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 13:32 ` Sergei Shtylyov 2015-04-08 13:32 ` Sergei Shtylyov 2015-04-08 13:40 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 03/14] ALSA: mts64: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 04/14] staging: panel: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 05/14] spi: lm70llp: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 06/14] spi: butterfly: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 07/14] [SCSI] ppa: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 08/14] [SCSI] imm: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 09/14] pps: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 10/14] " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 11/14] net: plip: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 12/14] i2c-parport: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee 2015-04-09 7:13 ` Wolfram Sang [this message] 2015-04-09 7:13 ` Wolfram Sang 2015-04-09 9:33 ` Jean Delvare 2015-04-09 10:25 ` Wolfram Sang 2015-04-09 10:25 ` Wolfram Sang 2015-04-10 5:05 ` Sudip Mukherjee 2015-04-10 5:05 ` Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 13/14] ppdev: " Sudip Mukherjee 2015-04-08 11:20 ` [PATCH 14/14] char: lp: " Sudip Mukherjee 2015-04-08 11:20 ` Sudip Mukherjee
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20150409071307.GA1166@katana \ --to=wsa@the-dreams.de \ --cc=JBottomley@parallels.com \ --cc=alsa-devel@alsa-project.org \ --cc=arnd@arndb.de \ --cc=broonie@kernel.org \ --cc=devel@driverdev.osuosl.org \ --cc=giometti@enneenne.com \ --cc=gregkh@linuxfoundation.org \ --cc=jdelvare@suse.de \ --cc=linux-i2c@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=perex@perex.cz \ --cc=sudipm.mukherjee@gmail.com \ --cc=tiwai@suse.de \ --cc=willy@meta-x.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.