Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org, Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: Can smatch handle this better? (was: [PATCH 15/17] media: i2c: adp1653: introduce 'no_child' label)
Date: Fri, 27 Jan 2023 15:41:31 +0300	[thread overview]
Message-ID: <Y9PGezJ9ww20xCup@kadam> (raw)
In-Reply-To: <7bd53f49-c7ae-db42-35a7-51d7b27d079c@xs4all.nl>

On Fri, Jan 27, 2023 at 08:43:51AM +0100, Hans Verkuil wrote:
> Hi Dan,
> 
> While trying to clean up smatch warnings in the media subsystem I came
> across a number of 'warn: missing unwind goto?' warnings that all had
> the same root cause as illustrated by this patch: the 'unwind' path
> just has a variation on printk(), it is not actually cleaning up anything.
> 
> As Sakari suggested, is this something that smatch can be improved for?
> These false positives are a bit annoying.
> 
> You can see the whole series here if you are interested:
> 
> https://patchwork.linuxtv.org/project/linux-media/list/?series=9747
> 
> Regards,
> 

Oh wow.  I really hate do nothing gotos.  The canonical bug for do
nothing gotos is forgetting to set the error code.

I like that check because it finds a lot of error handling bugs.

It's not just about the printk().  I could and probably should make the
check ignore printks.  There is also an of_node_put(child);

The check doesn't look at what the error handling does, only that there
is a direct returns surrounded by gotos.

I could make the check so that it's only enabled when --spammy is turned
on.

I guess another option would be to only enable the warning if there were
more than one label in the cleanup section at the end of the function.
I can make that a warning and if there is only one label, then make that
disable unless --spammy is used.

regards,
dan carpenter


  reply	other threads:[~2023-01-27 12:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 15:06 [PATCH 00/17] media: sparse/smatch fixes Hans Verkuil
2023-01-26 15:06 ` [PATCH 01/17] media: visl: make visl_qops static Hans Verkuil
2023-01-26 15:06 ` [PATCH 02/17] media: davinci/vpif.c: drop unnecessary cast Hans Verkuil
2023-01-30 23:33   ` Lad, Prabhakar
2023-01-26 15:06 ` [PATCH 03/17] media: i2c: s5c73m3: return 0 instead of 'ret' Hans Verkuil
2023-01-26 15:06 ` [PATCH 04/17] media: dvb-frontends: cxd2880: " Hans Verkuil
2023-01-26 15:06 ` [PATCH 05/17] media: usb: dvb-usb-v2: af9015.c: " Hans Verkuil
2023-01-26 15:06 ` [PATCH 06/17] media: dvb-frontends: cxd2880: " Hans Verkuil
2023-01-26 15:06 ` [PATCH 07/17] media: marvell: change return to goto for proper unwind Hans Verkuil
2023-01-26 15:06 ` [PATCH 08/17] media: dvb-frontends: drx39xyj: replace return with " Hans Verkuil
2023-01-26 15:06 ` [PATCH 09/17] media: nxp: imx-jpeg: replace dummy gotos by returns Hans Verkuil
2023-01-27 20:38   ` [EXT] " Mirela Rabulea
2023-01-26 15:06 ` [PATCH 10/17] media: mediatek: mdp3: replace return by goto for proper unwind Hans Verkuil
2023-02-08  7:38   ` Mauro Carvalho Chehab
2023-01-26 15:06 ` [PATCH 11/17] media: mediatek: vcodec/venc: return 0 instead of 'ret' Hans Verkuil
2023-01-26 15:06 ` [PATCH 12/17] media: ti: davinci: vpbe_display.c: " Hans Verkuil
2023-01-30 23:35   ` Lad, Prabhakar
2023-01-26 15:06 ` [PATCH 13/17] media: i2c: ov7670: 0 instead of -EINVAL was returned Hans Verkuil
2023-01-26 21:44   ` Sakari Ailus
2023-01-26 15:06 ` [PATCH 14/17] media: usb: go7007: add second unwind label Hans Verkuil
2023-01-26 15:06 ` [PATCH 15/17] media: i2c: adp1653: introduce 'no_child' label Hans Verkuil
2023-01-26 15:19   ` Sakari Ailus
2023-01-27  7:43     ` Can smatch handle this better? (was: [PATCH 15/17] media: i2c: adp1653: introduce 'no_child' label) Hans Verkuil
2023-01-27 12:41       ` Dan Carpenter [this message]
2023-01-27 13:00         ` Hans Verkuil
2023-01-27 14:51           ` Dan Carpenter
2023-01-26 15:06 ` [PATCH 16/17] media: st: delta: introduce 'err_too_many_comps' label Hans Verkuil
2023-01-26 15:06 ` [PATCH 17/17] media: dvb-frontends: mb86a16.c: always use the same error path Hans Verkuil

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=Y9PGezJ9ww20xCup@kadam \
    --to=error27@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --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