linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-input@vger.kernel.org
Subject: [dtor-input:next 104/120] drivers/input/serio/serio_raw.c:204:12: warning: variable 'written' is uninitialized when used here
Date: Sun, 20 Oct 2024 17:31:01 +0800	[thread overview]
Message-ID: <202410201730.ItNhUTIv-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
head:   00850d7b542aa4a8240cf977d43dc6d2158e48d7
commit: 5b53a9d40c4f83b44de8da06af9a9c9b3fb14988 [104/120] Input: serio_raw - use guard notation for locks and other resources
config: i386-buildonly-randconfig-002-20241019 (https://download.01.org/0day-ci/archive/20241020/202410201730.ItNhUTIv-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410201730.ItNhUTIv-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/input/serio/serio_raw.c:204:12: warning: variable 'written' is uninitialized when used here [-Wuninitialized]
     204 |                                 return written ?: -EIO;
         |                                        ^~~~~~~
   drivers/input/serio/serio_raw.c:188:13: note: initialize the variable 'written' to silence this warning
     188 |         int written;
         |                    ^
         |                     = 0
   1 warning generated.


vim +/written +204 drivers/input/serio/serio_raw.c

   182	
   183	static ssize_t serio_raw_write(struct file *file, const char __user *buffer,
   184				       size_t count, loff_t *ppos)
   185	{
   186		struct serio_raw_client *client = file->private_data;
   187		struct serio_raw *serio_raw = client->serio_raw;
   188		int written;
   189		unsigned char c;
   190	
   191		scoped_guard(mutex_intr, &serio_raw_mutex) {
   192			if (serio_raw->dead)
   193				return -ENODEV;
   194	
   195			if (count > 32)
   196				count = 32;
   197	
   198			while (count--) {
   199				if (get_user(c, buffer++))
   200					return -EFAULT;
   201	
   202				if (serio_write(serio_raw->serio, c)) {
   203					/* Either signal error or partial write */
 > 204					return written ?: -EIO;
   205				}
   206	
   207				written++;
   208			}
   209	
   210			return written;
   211		}
   212	
   213		return -EINTR;
   214	}
   215	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-10-20  9:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202410201730.ItNhUTIv-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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).