linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-media@vger.kernel.org,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Jan Kara <jack@suse.cz>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Michal Hocko <mhocko@suse.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/8] [media] v4l2-async: Delete an error message for a failed memory allocation in v4l2_async_notifier_unregister()
Date: Tue, 31 Jan 2017 07:55:07 -0200	[thread overview]
Message-ID: <20170131075507.45721c17@vento.lan> (raw)
In-Reply-To: <a00be613-169b-4992-dc29-c4b9e82d5501@users.sourceforge.net>

Em Mon, 26 Dec 2016 21:45:50 +0100
SF Markus Elfring <elfring@users.sourceforge.net> escreveu:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 26 Dec 2016 19:19:49 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> WARNING: Possible unnecessary 'out of memory' message
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/media/v4l2-core/v4l2-async.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
> index 277183f2d514..812d0b2a2f73 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -203,11 +203,6 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
>  		return;
>  
>  	dev = kmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
> -	if (!dev) {
> -		dev_err(notifier->v4l2_dev->dev,
> -			"Failed to allocate device cache!\n");
> -	}
> -

In this specific case, we should keep it, as the message means that
the unregister logic won't work properly, as this loop won't run:

        /*
         * Call device_attach() to reprobe devices
         *
         * NOTE: If dev allocation fails, i is 0, and the whole loop won't be
         * executed.
         */
	while (i--) {
                struct device *d = dev[i];

                if (d && device_attach(d) < 0) {
                        const char *name = "(none)";
                        int lock = device_trylock(d);

                        if (lock && d->driver)
                                name = d->driver->name;
                        dev_err(d, "Failed to re-probe to %s\n", name);
                        if (lock)
                                device_unlock(d);
                }
                put_device(d);
        }

So, IMHO, the proper patch would be to change the message to
be more comprehensive, describing the consequences of not being
able to allocate the dev cache.


>  	mutex_lock(&list_lock);
>  
>  	list_del(&notifier->list);



Thanks,
Mauro

  parent reply	other threads:[~2017-01-31 10:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 20:41 [PATCH 0/8] [media] v4l2-core: Fine-tuning for some function implementations SF Markus Elfring
2016-12-26 20:43 ` [PATCH 1/8] [media] v4l2-async: Use kmalloc_array() in v4l2_async_notifier_unregister() SF Markus Elfring
2016-12-27  9:52   ` Sakari Ailus
2016-12-26 20:45 ` [PATCH 2/8] [media] v4l2-async: Delete an error message for a failed memory allocation " SF Markus Elfring
2016-12-27 11:47   ` Sakari Ailus
2017-01-31  9:55   ` Mauro Carvalho Chehab [this message]
2016-12-26 20:47 ` [PATCH 3/8] [media] videobuf-dma-sg: Use kmalloc_array() in videobuf_dma_init_user_locked() SF Markus Elfring
2016-12-26 20:48 ` [PATCH 4/8] [media] videobuf-dma-sg: Adjust 24 checks for null values SF Markus Elfring
2017-01-09 10:30   ` Dan Carpenter
2016-12-26 20:50 ` [PATCH 5/8] [media] videobuf-dma-sg: Move two assignments for error codes in __videobuf_mmap_mapper() SF Markus Elfring
2016-12-26 20:51 ` [PATCH 6/8] [media] videobuf-dma-sg: Improve a size determination " SF Markus Elfring
2016-12-26 20:52 ` [PATCH 7/8] [media] videobuf-dma-sg: Delete an unnecessary return statement in videobuf_vm_close() SF Markus Elfring
2016-12-26 20:53 ` [PATCH 8/8] [media] videobuf-dma-sg: Add some spaces for better code readability in videobuf_dma_init_user_locked() SF Markus Elfring
2016-12-27 11:51 ` [PATCH 0/8] [media] v4l2-core: Fine-tuning for some function implementations Sakari Ailus
2017-01-02 14:54   ` Hans Verkuil
2017-09-22 20:08     ` SF Markus Elfring
2017-09-23  7:35       ` Hans Verkuil
2017-09-23 15:27         ` SF Markus Elfring

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=20170131075507.45721c17@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=elfring@users.sourceforge.net \
    --cc=jack@suse.cz \
    --cc=javier@osg.samsung.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lstoakes@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=mhocko@suse.com \
    --cc=sakari.ailus@linux.intel.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).