Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230459
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] sound: oss: ad1848: Fix returned errno code in ad1848_init() |
| Date | 2015-09-22 18:50 +0200 |
| Message-ID | <qbyVs-2z7-13@gated-at.bofh.it> (permalink) |
| References | <qbxPH-10s-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Sep 22, 2015 at 04:37:37PM +0100, Luis de Bethencourt wrote:
> The driver is using -1 instead of the -ENOMEM defined macro to specify
> that a buffer allocation failed. Since the error number is propagated,
> the caller will get a -EPERM which is the wrong error condition.
>
> Smatch tool warning:
> ad1848_init() warn: returning -1 instead of -ENOMEM is sloppy
>
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> sound/oss/ad1848.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
> index 10c8de1..6b35656 100644
> --- a/sound/oss/ad1848.c
> +++ b/sound/oss/ad1848.c
> @@ -1992,7 +1992,7 @@ int ad1848_init (char *name, struct resource *ports, int irq, int dma_playback,
> portc = kmalloc(sizeof(ad1848_port_info), GFP_KERNEL);
> if(portc==NULL) {
> release_region(devc->base, 4);
> - return -1;
> + return -ENOMEM;
The return value of ad1848_init is stored in hw_config->slots[0].
And in sound/oss/pss.c hw_config->slots[0] is checked like:
if (hw_config->slots[0] != -1)
So, you just changed the functionality of the driver.
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] sound: oss: ad1848: Fix returned errno code in ad1848_init() Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-22 17:40 +0200
Re: [PATCH] sound: oss: ad1848: Fix returned errno code in ad1848_init() Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-22 18:50 +0200
Re: [PATCH] sound: oss: ad1848: Fix returned errno code in ad1848_init() Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-22 21:20 +0200
Re: [PATCH] sound: oss: ad1848: Fix returned errno code in ad1848_init() Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-23 08:30 +0200
csiph-web