X86 platform drivers
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Dan Carpenter <error27@gmail.com>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: [bug report] platform/x86: ISST: Add IOCTL default callback
Date: Thu, 16 Mar 2023 12:02:04 -0700	[thread overview]
Message-ID: <c6e93a83e9605ca127483dc3e7dbcf97c6961e06.camel@linux.intel.com> (raw)
In-Reply-To: <25a8ef35-5274-4990-a683-040aacaa8d3a@kili.mountain>

Hi Dan,

On Fri, 2023-03-10 at 14:57 +0300, Dan Carpenter wrote:
> Hello Srinivas Pandruvada,
> 
> The patch 33c16dc1a2d1: "platform/x86: ISST: Add IOCTL default
> callback" from Feb 10, 2023, leads to the following Smatch static
> checker warning:
> 
>         drivers/platform/x86/intel/speed_select_if/isst_if_common.c:6
> 29 isst_if_def_ioctl()
>         info: return a literal instead of 'ret'
> 
I use your blog
https://blogs.oracle.com/linux/post/smatch-static-analysis-tool-overview-by-dan-carpenter

smatch/smatch_scripts/kchecker --spammy
drivers/platform/x86/intel/speed_select_if/isst_if_common.c
  CHECK   scripts/mod/empty.c
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC [M]  drivers/platform/x86/intel/speed_select_if/isst_if_common.o
  CHECK   drivers/platform/x86/intel/speed_select_if/isst_if_common.c

Also tried with 
https://smatch.sourceforge.net/

make CHECK="~/path/to/smatch/smatch -p=kernel" C=1 \
                bzImage module

What is the correct way to run this to get this error?

Thanks,
Srinivas

> drivers/platform/x86/intel/speed_select_if/isst_if_common.c
>     615         case ISST_IF_MSR_COMMAND:
>     616                 cmd_cb.cmd_size = sizeof(struct
> isst_if_msr_cmd);
>     617                 cmd_cb.offset = offsetof(struct
> isst_if_msr_cmds, msr_cmd);
>     618                 cmd_cb.cmd_callback = isst_if_msr_cmd_req;
>     619                 ret = isst_if_exec_multi_cmd(argp, &cmd_cb);
>     620                 break;
>     621         default:
>     622                 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
>     623                         struct isst_if_cmd_cb *cb =
> &punit_callbacks[i];
>     624                         int ret;
>     625 
>     626                         if (cb->def_ioctl) {
>     627                                 ret = cb->def_ioctl(file,
> cmd, arg);
>     628                                 if (!ret)
> --> 629                                         return ret;
> 
> This returns the first time something succeeds.  Normally it would be
> the other way around, where we return the first time something fails.
> If this is really intentional it would be better to do an explicit
> "return 0;"
> 
>     630                         }
>     631                 }
>     632                 break;
>     633         }
>     634 
>     635         return ret;
>     636 }
> 
> regards,
> dan carpenter


  reply	other threads:[~2023-03-16 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 11:57 [bug report] platform/x86: ISST: Add IOCTL default callback Dan Carpenter
2023-03-16 19:02 ` srinivas pandruvada [this message]
2023-03-18  8:56   ` Dan Carpenter

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=c6e93a83e9605ca127483dc3e7dbcf97c6961e06.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=error27@gmail.com \
    --cc=platform-driver-x86@vger.kernel.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: 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