From patchwork Wed Apr 10 21:54:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 788715 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C22AF18410C for ; Wed, 10 Apr 2024 21:54:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786089; cv=none; b=I92+eHQo2uhdSt4MnJkns8KX2RJgxXCrh7MuZdUA4RtvD+dhhnH07phR5fKu8Q/vERXbumI7n8q1Oi+cllJ1QfBT13GnKU1ghI+k8S+jfYUBFSce6HWKhVl9ZP8edW9jTCDEcGMUPGnob5o7jAXgSyLeuyh5VOa7qEgOMFPuAfo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786089; c=relaxed/simple; bh=rzGNe4hZhMnB8M/40dl2p6r/nVedCnlrPhrsN56MHoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fwTr+TYzuiBHHKrcOntCHOeo4i1cd0Egh1NhuQt9Ab1dt3h19hBBv/GJIj2F5oXuq6avaqvQaJhu04o5kiljo9twszzGo73oSSGDihZ+qpF24rVu5fbydzS/ZZUx7e4jQ45xBgK6i5Yr8g1ib8kLKoKn+cDrnywr7Pb6P4fDpv4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=F/eeD8sE; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="F/eeD8sE" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-434da723234so4512921cf.2 for ; Wed, 10 Apr 2024 14:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712786086; x=1713390886; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nPW2ppTL8S189BnwjTGvFf2yuc7RYQzJKkrIYHPYwNk=; b=F/eeD8sEjrY+EhekZafyZQoJa27/IyQrTtkPnnDb5U32vvUEhclqgJvnkF3yk2IA9s b/I2HvnnaY4uosfvxdHNI9Y47+AKPYlkUJ9vjHEzNxwYapYUYRJ+hONV3g5voEXutj1R S91spzMhdSx1FopiRRS3HNBIvbRWtNgmhSq2U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786086; x=1713390886; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nPW2ppTL8S189BnwjTGvFf2yuc7RYQzJKkrIYHPYwNk=; b=N4K4Pup3EBetQymybtqnI1AbyizULO2S5l305GuXAdEDUkDAJogCJE+0RYz1tQzOmA /WVIOmT+yVoW+bn39dqw5rUfeUPeoMEEBNytOmOds2fAtlbJzlpjMXQfy21Ag9xy4JWU 2dTDxbWL+rR/Iaw1Dfk5lMcfWZB8WRrRGn50bCGmFQr/S9iEBwRhbP1nfBxrGIQW1qIc hTenO5r1dZIYyN+WWP8tWMHds3QMPt4FVZk4Mx1XPbLwL/Bh46cRXTTtDil45ANvmDTP BsEkpggAxi80gZe3yWmuH6Xe/fKQ7ypd5CG8L896T8JiY1i4a1hcK2K4hacSBRJxBhqn SI+A== X-Forwarded-Encrypted: i=1; AJvYcCXPCbjsmb8aeniq2DXQDvHcvHYz4K6Gb11tg4BQkedqdzDAOCyJjRRkDhSqxBNJKduWWHjjfjuzw29NzEYWPZt/kxLZybcyM1ZPnyc= X-Gm-Message-State: AOJu0Yxz+dyLkGZGJFaJvTrCIjun0RfVnFsfHMiL9BQja8VrA4Gv3h3q fI1XUJHO6X4ExfR4PFxUztdy22J6uuj9cx/nHk007y1w91oT4UL5K+glHfOY48nkHg6MlLSq3Ck qRg== X-Google-Smtp-Source: AGHT+IGqJ1+HwPYyX9JNsLSdWW24aYLgwinvggdSsd1dVYnvyZyEESK2vRNNPs8/wL4dw6XEd0RjjQ== X-Received: by 2002:a05:622a:10b:b0:436:5628:d6a6 with SMTP id u11-20020a05622a010b00b004365628d6a6mr818871qtw.48.1712786086346; Wed, 10 Apr 2024 14:54:46 -0700 (PDT) Received: from denia.c.googlers.com (188.173.86.34.bc.googleusercontent.com. [34.86.173.188]) by smtp.gmail.com with ESMTPSA id kg26-20020a05622a761a00b00434c1eedb0esm67330qtb.36.2024.04.10.14.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:54:45 -0700 (PDT) From: Ricardo Ribalda Date: Wed, 10 Apr 2024 21:54:38 +0000 Subject: [PATCH 1/6] media: usb: siano: Fix allocation of urbs Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240410-smatch-v1-1-785d009a852b@chromium.org> References: <20240410-smatch-v1-0-785d009a852b@chromium.org> In-Reply-To: <20240410-smatch-v1-0-785d009a852b@chromium.org> To: Mauro Carvalho Chehab , Yasunari Takiguchi , Jean-Christophe Trotin , Lars-Peter Clausen , Dmitry Torokhov Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 USB urbs must be allocated with usb_alloc_urb. Quoting the manual Only use this function (usb_init_urb) if you _really_ understand what you are doing. Fix the following smatch error: drivers/media/usb/siano/smsusb.c:53:38: warning: array of flexible structures Signed-off-by: Ricardo Ribalda --- drivers/media/usb/siano/smsusb.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index 723510520d092..d85308e0785db 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -40,7 +40,7 @@ struct smsusb_urb_t { struct smscore_buffer_t *cb; struct smsusb_device_t *dev; - struct urb urb; + struct urb *urb; /* For the bottom half */ struct work_struct wq; @@ -160,7 +160,7 @@ static int smsusb_submit_urb(struct smsusb_device_t *dev, } usb_fill_bulk_urb( - &surb->urb, + surb->urb, dev->udev, usb_rcvbulkpipe(dev->udev, dev->in_ep), surb->cb->p, @@ -168,9 +168,9 @@ static int smsusb_submit_urb(struct smsusb_device_t *dev, smsusb_onresponse, surb ); - surb->urb.transfer_flags |= URB_FREE_BUFFER; + surb->urb->transfer_flags |= URB_FREE_BUFFER; - return usb_submit_urb(&surb->urb, GFP_ATOMIC); + return usb_submit_urb(surb->urb, GFP_ATOMIC); } static void smsusb_stop_streaming(struct smsusb_device_t *dev) @@ -178,7 +178,7 @@ static void smsusb_stop_streaming(struct smsusb_device_t *dev) int i; for (i = 0; i < MAX_URBS; i++) { - usb_kill_urb(&dev->surbs[i].urb); + usb_kill_urb(dev->surbs[i].urb); if (dev->surbs[i].wq.func) cancel_work_sync(&dev->surbs[i].wq); @@ -338,6 +338,8 @@ static void smsusb_term_device(struct usb_interface *intf) struct smsusb_device_t *dev = usb_get_intfdata(intf); if (dev) { + int i; + dev->state = SMSUSB_DISCONNECTED; smsusb_stop_streaming(dev); @@ -346,6 +348,9 @@ static void smsusb_term_device(struct usb_interface *intf) if (dev->coredev) smscore_unregister_device(dev->coredev); + for (i = 0; i < MAX_URBS; i++) + usb_free_urb(dev->surbs[i].urb); + pr_debug("device 0x%p destroyed\n", dev); kfree(dev); } @@ -390,6 +395,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) void *mdev; int i, rc; int align = 0; + int n_urb = 0; /* create device object */ dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); @@ -461,9 +467,11 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) dev->coredev->is_usb_device = true; /* initialize urbs */ - for (i = 0; i < MAX_URBS; i++) { - dev->surbs[i].dev = dev; - usb_init_urb(&dev->surbs[i].urb); + for (n_urb = 0; n_urb < MAX_URBS; n_urb++) { + dev->surbs[n_urb].dev = dev; + dev->surbs[n_urb].urb = usb_alloc_urb(0, GFP_KERNEL); + if (!dev->surbs[n_urb].urb) + goto free_urbs; } pr_debug("smsusb_start_streaming(...).\n"); @@ -485,6 +493,10 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) return rc; +free_urbs: + for (i = 0; i < n_urb; i++) + usb_free_urb(dev->surbs[n_urb].urb); + err_unregister_device: smsusb_term_device(intf); #ifdef CONFIG_MEDIA_CONTROLLER_DVB From patchwork Wed Apr 10 21:54:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 787751 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 635B8184114 for ; Wed, 10 Apr 2024 21:54:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786089; cv=none; b=jwHKxHAeSbkDtMqGG7qOiJwRSb08BCI+fGJyZhXfgbZ83Zaazt8kUU2xWtd77+jMZj0Zg4uGvO4IcewJ1qkDmaou/4hY98avIQuIhE/8PA+P5+na1AL9AdGNaeFLaESVjDloX0/u5+9bM2PM8KoOSU10zIwxMWkFdx2fKgfLDY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786089; c=relaxed/simple; bh=EzXC/4xYw8bpGVae+0wn0GICDiD54D8PeB0vdxO26YU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RxU3+PoIU1sHudqG+n+IRGDhiI25z7qzO5RlsMhe5L1FcfW2FQf/nalgKlf/GT0mX5i4lfLaGtxGgnmaEWssXvOHJNGss3u7I7n7gM3XAfMC8pYcJCJCx1LJWA47LeAn56/59hS6PDJztZ06X4AdM1/vJfjqCEiYAGqGG551cxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=n96c89I7; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="n96c89I7" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-4347dadc2cfso28422191cf.3 for ; Wed, 10 Apr 2024 14:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712786087; x=1713390887; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Nzns2XXp3BgsyesnfwW5lSLxfDYY59eLeE+bSWeFTSk=; b=n96c89I7TMHVMCc/s6vrIhqnxubPtwm+pP7n4E2Etkr7KLOibOht7/atptAJVm5qQE 5a8sOfSNQU9I7RvHh66kkv3XPQa+DWLpX1Jrv3398ZIdLUpbUST13bMnP4qkoifkHLLo 5RMXkdJUCUBS6WvuorAfXfMT9pzdmgj+Eocxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786087; x=1713390887; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nzns2XXp3BgsyesnfwW5lSLxfDYY59eLeE+bSWeFTSk=; b=LWhSC4NCs2UJRWuwDniVjurD5qxRFHP45KSQRW0BDyRcrtQCNjIv0OsXUbUAP2Xvtw Hrv8zsxdr1m9VPYewmxhKuFBjsmmt2ec7M79FRpYM8lsMAsn4FQ/YKM/pAk8AH0+zMT/ zDR6CU94ZlIAJCwsk9PT2bPlm6Zpxt3b/blukbk9vkfUOd6HplrFhgtfpLAPUJOPZSrY Fw40DitpvgWlm/xpaqlUQra/30n+VCIGI9VgsaLxqZ/8oMvD4lBMEe8pNjqBIldJXSYW RpbNe6ecqfFQFNxDk2t87tU0D14xmDQAgM8sgZWhNU418t3RNkt/jNy84BNJdrBhkJON qkfg== X-Forwarded-Encrypted: i=1; AJvYcCWim/xp3cjArwuzTi6wb0bvhJuZp4vL/e78oDBkelgBy2jp+vueapDySetDW5CkJ48Z8wqH52RDqtItjCudq4BjTTwZuqzJQIjp2tA= X-Gm-Message-State: AOJu0Yx3W6yIoWs8OYALjXd1aIJCQn3rxylbi6RkRvjoKYjyHdygJqK6 Efv5XpMoQwJjXU78XofHxvJlDgRTH6VvLZlRlYd+m7MtpySCNmg4NGTt0oakgnJatGeK+LKWEjF vXw== X-Google-Smtp-Source: AGHT+IH9ibfw4+QYfFH/7vnhBrr0v60dMc5TlmaLcG2PPAu465t/Cz8VYSfyv7RTeGYj9Z4zy/bAtA== X-Received: by 2002:ac8:5f0a:0:b0:434:b349:da7 with SMTP id x10-20020ac85f0a000000b00434b3490da7mr4288466qta.26.1712786087041; Wed, 10 Apr 2024 14:54:47 -0700 (PDT) Received: from denia.c.googlers.com (188.173.86.34.bc.googleusercontent.com. [34.86.173.188]) by smtp.gmail.com with ESMTPSA id kg26-20020a05622a761a00b00434c1eedb0esm67330qtb.36.2024.04.10.14.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:54:46 -0700 (PDT) From: Ricardo Ribalda Date: Wed, 10 Apr 2024 21:54:39 +0000 Subject: [PATCH 2/6] media: cxd2880: Replaze kmalloc with kzalloc Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240410-smatch-v1-2-785d009a852b@chromium.org> References: <20240410-smatch-v1-0-785d009a852b@chromium.org> In-Reply-To: <20240410-smatch-v1-0-785d009a852b@chromium.org> To: Mauro Carvalho Chehab , Yasunari Takiguchi , Jean-Christophe Trotin , Lars-Peter Clausen , Dmitry Torokhov Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 Fix smatch error: drivers/media/spi/cxd2880-spi.c:391 cxd2880_start_feed() warn: Please consider using kzalloc instead of kmalloc Signed-off-by: Ricardo Ribalda --- drivers/media/spi/cxd2880-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c index 6be4e5528879f..65fa7f857fcaf 100644 --- a/drivers/media/spi/cxd2880-spi.c +++ b/drivers/media/spi/cxd2880-spi.c @@ -388,7 +388,7 @@ static int cxd2880_start_feed(struct dvb_demux_feed *feed) if (dvb_spi->feed_count == 0) { dvb_spi->ts_buf = - kmalloc(MAX_TRANS_PKT * 188, + kzalloc(MAX_TRANS_PKT * 188, GFP_KERNEL | GFP_DMA); if (!dvb_spi->ts_buf) { pr_err("ts buffer allocate failed\n"); From patchwork Wed Apr 10 21:54:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 787750 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 431D9184128 for ; Wed, 10 Apr 2024 21:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786091; cv=none; b=VvqwdKfTIJMVfpM23RLPk8ufmRYRd4+qsm0cPZX/unOqyK9PyY45bL5Sqe7Hdf9znNrexGaQSkmMJmDqqaA2dN2OA3uuxj9kS3KooZnVnOXtBQ2DKGoiM0M1MqQXKikzSf17bTZa178w4DMRAVX80tCItN3/ULVieoKwlhUlruA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786091; c=relaxed/simple; bh=CNOEK2aWkC3W8YJDXsiqotp6WsB7BgDuWRBpQs7crVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ke2EAcpLZQZ9S+wLk8BDnkDXtHfI90T2eP5UMcCpfhCRNW+ITedNGKlt54QgUu3RiY4RnBhRaQAu7HKy/UVV+ULEix6OhaqUYZPl85I5qQXOCUadJVEj8xt0Su4xa2DUxT5w7568BbsNcME6PN5/Osvci/Xnj6Z1Q7Mjw8vyuNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=SCZqqIHh; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SCZqqIHh" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dc74e33fe1bso6507305276.0 for ; Wed, 10 Apr 2024 14:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712786088; x=1713390888; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=s6vhOcczX0Rso19zsRzhH1nUym0L4HSC9FS2OUDhpCI=; b=SCZqqIHhAbzTPWD+OERGE/77Jwb5jSH/ZN9+jIiYC4RhRU4pYeLTtQ8S0cjQm08oX4 ZLaTYJoh1V+WQRE0WQaAyxucj/8t3Mn9Rdcw1EWUchjIpP1+5OXFHgqgLbyfLtMTxvKN ThiQCA1T3+VLDlGfGNUQsQwyJ9TPb63f9x608= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786088; x=1713390888; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s6vhOcczX0Rso19zsRzhH1nUym0L4HSC9FS2OUDhpCI=; b=O/K6lWCaYwHfZTaEmOVkjoEF7l81UUUdpyf6z4Sv+phFDbcVh5rDG1N+FSYHMP11wu XETgLGzzYAFQ206vI/mqMm0vI33z09CQjuedKUg+yQ7RxLadENt5GwqTOpV8qSgHJ8KI l+KOBqqe291OBe/hBezbFnmGXA1S8uJOUSnmFQBZbGtxTYa3AU5LCaYM69FnkNssfBWh TxbQDdVYUjP9TSB4fAj1diEJIpjEN4klJinbG9rlbFSWojMoSc1p/eshWOIQ2aGdQmo6 yZwV1yIwz4HD3JAZZ3/osl/jGdT3HriS4a+uCegz0cqefys1jCJUdixpKtMl1kd5eh7r u3BA== X-Forwarded-Encrypted: i=1; AJvYcCVCJe3Rz+sXUezEx6SIGea4aylmgeqMsjKuaiu4Sjww2kEiOskjsvZBHznKWL76aVK2GPUJtcxAkQF5xHsfYq9S3Q/oabzJ/VVkZ2U= X-Gm-Message-State: AOJu0YzTaSxDk3qBNZFt8JolHbMfDa2/VXc0OgCo3+u/1pnRm7PQIi0P g+V8b/rcVxYywjEaMeyjj5VA9aMsLaCP9Q8/J08ciE3Xrj98rSwTdlmYeFiTF49SrlruEoBCuZT QUw== X-Google-Smtp-Source: AGHT+IGIfO/2mFuyvVoujR3E89kj5KMNHwJfRYxvWyAQjc1xNMc4jdF0XAAcb1kFRJTlscFJbgdi9Q== X-Received: by 2002:a25:acc1:0:b0:dcd:5bfa:8184 with SMTP id x1-20020a25acc1000000b00dcd5bfa8184mr4697141ybd.39.1712786087887; Wed, 10 Apr 2024 14:54:47 -0700 (PDT) Received: from denia.c.googlers.com (188.173.86.34.bc.googleusercontent.com. [34.86.173.188]) by smtp.gmail.com with ESMTPSA id kg26-20020a05622a761a00b00434c1eedb0esm67330qtb.36.2024.04.10.14.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:54:47 -0700 (PDT) From: Ricardo Ribalda Date: Wed, 10 Apr 2024 21:54:40 +0000 Subject: [PATCH 3/6] media: platform: sti: hva: clk_unprepare unconditionally Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240410-smatch-v1-3-785d009a852b@chromium.org> References: <20240410-smatch-v1-0-785d009a852b@chromium.org> In-Reply-To: <20240410-smatch-v1-0-785d009a852b@chromium.org> To: Mauro Carvalho Chehab , Yasunari Takiguchi , Jean-Christophe Trotin , Lars-Peter Clausen , Dmitry Torokhov Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 hva->clk cannot be NULL at this point. Simplify the code and make smatch happy: drivers/media/platform/st/sti/hva/hva-hw.c:412 hva_hw_probe() warn: 'hva->clk' from clk_prepare() not released on lines: 412 Signed-off-by: Ricardo Ribalda --- drivers/media/platform/st/sti/hva/hva-hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/st/sti/hva/hva-hw.c b/drivers/media/platform/st/sti/hva/hva-hw.c index fe4ea2e7f37e3..fcb18fb52fdd7 100644 --- a/drivers/media/platform/st/sti/hva/hva-hw.c +++ b/drivers/media/platform/st/sti/hva/hva-hw.c @@ -406,8 +406,7 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) err_disable: pm_runtime_disable(dev); err_clk: - if (hva->clk) - clk_unprepare(hva->clk); + clk_unprepare(hva->clk); return ret; } From patchwork Wed Apr 10 21:54:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 788714 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D06D2190661 for ; Wed, 10 Apr 2024 21:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786091; cv=none; b=E2Pa1ATkYZ+icB8hHdf7qPsQXiYhIy6ZP1+Vf0uw8cDFf9x919v8dCHs46HjkVaYjMNGjHu5vYtLOVgTTj8gIC7FBa3QlrnYTK8c2bebHO729sDc1LSW38Hdrlnj5gDs7p0438qgG644C6A53Z3TtBGqrQWV46aTNbNU+IcU13w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786091; c=relaxed/simple; bh=XZj893oOgJO+TuxebqQUH7FBZLqRq2EAjtnxNCWS4dQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fRb5KQjrEXMkuAz2rr27flOW9yhf5Vc28QM6AB2ZjFQkZP7mUYTLTgtzLXEELKHoMSFUiDgeil9UOes3R2wpTJxcajr+JSD0gywesVwXZ7qwkTmGBAUzO203yIaenEujpTr/RCast0HYFaCwuYxf6Cnp+xcWpqsuA0Id3985pSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Vs+sGN5v; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Vs+sGN5v" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6ea26393116so1566618a34.0 for ; Wed, 10 Apr 2024 14:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712786088; x=1713390888; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=udjeys4Odih0ujJKT10PCL6WQWBbIkHJU3t+XfW9ZzY=; b=Vs+sGN5vS13k1kK+yHJoP7NFOtTQvWYNPAxMOSPndIMYRuZCnvxeQ971u1t3HaGgP+ e+pVM4yEd0+Bx4d6FmTo4b5uGugVI+5VgouOza5n1VqgGF9Kqr2UBuJpmO0iOsWsV8Zh pDzRWsTnqMA0mqLTUpkq7yJQXUSsYmz2qxP8k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786088; x=1713390888; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=udjeys4Odih0ujJKT10PCL6WQWBbIkHJU3t+XfW9ZzY=; b=LL5FYdUuifiuFIuVy1JzI9weJ05BDxc2WbN9BE7gr8geZr39EjQFPUWER4ypQBnZyx 19vmF+OSD120o672dg7NbAqhXIG5UDMrZyQBahhcfzWiWLVaLNl4F66ygIiRK/5JANl+ frpvzw/dUhwG7AwardiJZ9Q3OLiQ77xVnkXv1SPn4FIePzoC4mJaM1xGQX4GJw1oF7i8 TV5NCnNclCqRhQPkMhoG/USmHjATHr7GtEORPU4r2xCt75nKB1H9a4IGNzZQV3sF6YKK ecLA0IEzmwV8v3UixixsNTYGkRI2PDLBhigBhnJMOkXylKZe3koy1fEyEi5iNvy/bM4v CmMg== X-Forwarded-Encrypted: i=1; AJvYcCVXoKASwgkB84okmAZKD0AuA6zAuuVUsJ2A26lJ1pxvyl0l9ThxZLNs3VvSD7a2KvHVOOMHTdhOStbcRzpFOW+sJhAjHJ9Wnw/VajM= X-Gm-Message-State: AOJu0YxcXom0m3SZCDPyKAe4FsFR/taI1uCyhdU6HDkNiDEJi2hXp6vd Im7ervX/VJXcXZJA68Eoofl9pjZwb1G9FOYAzLzY/GkoVwzFPkjvHiXh1E3T0VJiDu1HChhGcW7 IMQ== X-Google-Smtp-Source: AGHT+IHR53mUa7EISt68wfOzVTMhiwwKLj8khagoL81qi8dkm725vDXUVJ8C3dvMoDM7Stak1r7Z3w== X-Received: by 2002:a05:6808:b10:b0:3c6:1412:3541 with SMTP id s16-20020a0568080b1000b003c614123541mr424100oij.34.1712786088631; Wed, 10 Apr 2024 14:54:48 -0700 (PDT) Received: from denia.c.googlers.com (188.173.86.34.bc.googleusercontent.com. [34.86.173.188]) by smtp.gmail.com with ESMTPSA id kg26-20020a05622a761a00b00434c1eedb0esm67330qtb.36.2024.04.10.14.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:54:48 -0700 (PDT) From: Ricardo Ribalda Date: Wed, 10 Apr 2024 21:54:41 +0000 Subject: [PATCH 4/6] media: v4l2-ctrls-core.c: Do not use iterator outside loop Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240410-smatch-v1-4-785d009a852b@chromium.org> References: <20240410-smatch-v1-0-785d009a852b@chromium.org> In-Reply-To: <20240410-smatch-v1-0-785d009a852b@chromium.org> To: Mauro Carvalho Chehab , Yasunari Takiguchi , Jean-Christophe Trotin , Lars-Peter Clausen , Dmitry Torokhov Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 Simplify a bit the code introducing a new variable for iterating through the control list. It also makes smatch happy: drivers/media/v4l2-core/v4l2-ctrls-api.c:1091 v4l2_query_ext_ctrl() warn: iterator used outside loop: 'ref' Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-ctrls-api.c | 33 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c index d9a422017bd9d..42b7a45bfa79c 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -1052,35 +1052,40 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr if (id >= node2id(hdl->ctrl_refs.prev)) { ref = NULL; /* Yes, so there is no next control */ } else if (ref) { + struct v4l2_ctrl_ref *pos = ref; + /* * We found a control with the given ID, so just get * the next valid one in the list. */ - list_for_each_entry_continue(ref, &hdl->ctrl_refs, node) { - is_compound = ref->ctrl->is_array || - ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES; - if (id < ref->ctrl->id && - (is_compound & mask) == match) + ref = NULL; + list_for_each_entry_continue(pos, &hdl->ctrl_refs, node) { + is_compound = pos->ctrl->is_array || + pos->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES; + if (id < pos->ctrl->id && + (is_compound & mask) == match) { + ref = pos; break; + } } - if (&ref->node == &hdl->ctrl_refs) - ref = NULL; } else { + struct v4l2_ctrl_ref *pos; + /* * No control with the given ID exists, so start * searching for the next largest ID. We know there * is one, otherwise the first 'if' above would have * been true. */ - list_for_each_entry(ref, &hdl->ctrl_refs, node) { - is_compound = ref->ctrl->is_array || - ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES; - if (id < ref->ctrl->id && - (is_compound & mask) == match) + list_for_each_entry(pos, &hdl->ctrl_refs, node) { + is_compound = pos->ctrl->is_array || + pos->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES; + if (id < pos->ctrl->id && + (is_compound & mask) == match) { + ref = pos; break; + } } - if (&ref->node == &hdl->ctrl_refs) - ref = NULL; } } mutex_unlock(hdl->lock); From patchwork Wed Apr 10 21:54:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 788713 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8004419067C for ; Wed, 10 Apr 2024 21:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786092; cv=none; b=i5adQkRzoPzAirczE4mZ9cKIfi17uG/zEDdzm4EZS8kgV+dXeFTGQMXHEB9P+13w0a9JZBlQe2qIU6FNauzQ1o4XSUjjQqlUwP6AXig46Iw/9USrsZyfjUfF9VmOmbECr0GOQoOTtYI/jbtVNO9927AkPgZk8UquPNz5R/ZkGWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786092; c=relaxed/simple; bh=erFijxCE7zR4MV8ri3c+dXbrtlOTrRZHHMfpIM9iaXc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bE1brcADA2+GlvwOWeKpkN6Mwcx7aGFwz5FFSwoMic7swmRy6bJPOx+I+t9NhrMKY6KB1hNkwbHS+mk3+Km3ZrkhtQBj01oAHGcB6YT30POCzrRfnSaJsRT5L/m09wpHgCisFiBqo7WAndOwKKgY99baTuHgcMzJQ3AQFvaKxTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dj0O1aJc; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dj0O1aJc" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-434942fb16aso11970771cf.2 for ; Wed, 10 Apr 2024 14:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712786089; x=1713390889; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8qecfLVtRY76Bzg8oTSRe9RiU8Ab1ycKtqOn34KzQpM=; b=dj0O1aJcd8aLrfFIDPAHRcIK0AoBdX/2TG3hNhzkW/pkpX4cQ3HNqIG32rAX5V/c++ 2yBq0kx0oOgpcQOcbBwtKsm72jiUIrvuG+hPgJzmhpmEhO3fnnihkkOwqfSY6viUeqVR Mch4HjnRyMWJkzTxbKkEdsmEatC4ucBWeHFG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786089; x=1713390889; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8qecfLVtRY76Bzg8oTSRe9RiU8Ab1ycKtqOn34KzQpM=; b=tmm9++OF0qZbccrkRoIK2Yes8HcBapA+vnqUrVxbhOsIFjd5byZXFzAVW6w6Os0sKT gziy3eK5uSDzMrMBoECYcuM+hfY3Pl1Nyyt3fGG1yqDXiEx4LKyiY970UTxEALEwiOE/ L5Bw/42s2NFqFWfLTF64w08BsfoTRr04+WXNCOGzBmrBvhDHq71klpF8jbx1on9C4er0 pHp3efavCQtJgsYNMv8+W00SG3MWvyuW2PjkP5fTSS4QrHK1cHOnBxY0f3z39K/99CmJ kDFwHD5qI1uMwXfx21IB7VDH8voW0bMOecYxdg+yLSwIQRTxE93JOiHhuDsNWqsSnEzT LSHw== X-Forwarded-Encrypted: i=1; AJvYcCXumlDEJy1QXdyRoSlz3dMtzKZx79AOET6pLbz5760HoOo26WrhFD3CYcSsOSI/1w64dWwZ5LIzt1cZxdAV0JfVJCeAmrDibIpIsrw= X-Gm-Message-State: AOJu0YyOKs0Evsg7JgWxi7X3/T9KKlfaehfMZZUobsjd6CpVcCPmNfsg /wkIS+9aQ4SfP7kMMS/fRVsPgugTHYtj/Va0biv0x96SEYuM97QZ1ZsKDDCSxaz9Tjl3bn6gb9f gYw== X-Google-Smtp-Source: AGHT+IHWRJcHJfSG5kAL0HKOg8jZfMWKObhg9YFida2UCaj9AtmVdqisiCqcJB1326MCtC9PfVIBrQ== X-Received: by 2002:ac8:7f42:0:b0:434:8cf5:b274 with SMTP id g2-20020ac87f42000000b004348cf5b274mr4147900qtk.59.1712786089349; Wed, 10 Apr 2024 14:54:49 -0700 (PDT) Received: from denia.c.googlers.com (188.173.86.34.bc.googleusercontent.com. [34.86.173.188]) by smtp.gmail.com with ESMTPSA id kg26-20020a05622a761a00b00434c1eedb0esm67330qtb.36.2024.04.10.14.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:54:49 -0700 (PDT) From: Ricardo Ribalda Date: Wed, 10 Apr 2024 21:54:42 +0000 Subject: [PATCH 5/6] media: adv7180: Only request valids IRQs Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240410-smatch-v1-5-785d009a852b@chromium.org> References: <20240410-smatch-v1-0-785d009a852b@chromium.org> In-Reply-To: <20240410-smatch-v1-0-785d009a852b@chromium.org> To: Mauro Carvalho Chehab , Yasunari Takiguchi , Jean-Christophe Trotin , Lars-Peter Clausen , Dmitry Torokhov Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 i2c_device_probe(), seems to assume that irq = 0 means that there is no irq to request. The driver also believes that on the clean path. So lets be consistent here. Also make smatch happy. Fix: drivers/media/i2c/adv7180.c:1526 adv7180_probe() warn: 'client->irq' from request_threaded_irq() not released on lines: 1526 Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/adv7180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 4829cbe324198..819ff9f7c90fe 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -1486,7 +1486,7 @@ static int adv7180_probe(struct i2c_client *client) if (ret) goto err_media_entity_cleanup; - if (state->irq) { + if (state->irq > 0) { ret = request_threaded_irq(client->irq, NULL, adv7180_irq, IRQF_ONESHOT | IRQF_TRIGGER_FALLING, KBUILD_MODNAME, state); From patchwork Wed Apr 10 21:54:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 787749 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3433A190696 for ; Wed, 10 Apr 2024 21:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786092; cv=none; b=kjg73HcyB0BcP6KJDi4oFt7ZPF60Umj3HHf2aGF5c1SpfZICYtaCOEIeNVqIIM32GANowxfxPzzXhexyMJfFdQHZLPiJHwkTFrUhMdXSEtdzA4FmQO1k4IMPj7ybFwCLhhxH2W+yH2znsO4H45CMCXdNidHwgjB2XnNZ6QATGLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712786092; c=relaxed/simple; bh=qYUzmqmdLZgDJPzb/J2uf6pd/pTz/IsAT54nGnkJH48=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BoK90sURhn+/11xpgxfy+atxQ6u81RmkC1eDjRFwSvPL02TbZXX1OoQ1899nfNu46YYZ6x0a+2JZdvYjh6eGEcpwLIZ2dqt29DaesrJnm34dReAkNeh0qAX4J3GjgQKhcoy/yf7dLAlbnZvO3pPpKGNF6sF9feDPS94g6gAIV6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dhuK/Gub; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dhuK/Gub" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-434da723234so4513111cf.2 for ; Wed, 10 Apr 2024 14:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712786090; x=1713390890; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qTzjP1Nv4ThzlLlE1Ju5kdcsL0LhZGtnYro6XcnlOmk=; b=dhuK/Gubb2eeHhJXl6V5/9G4V3kAKIumQyn5+PG8yTe1F1kXUknFJfB4MEs0hv/NNF RG3vjW0kOgl/N6Y+3wrt2JYaFoz6P9Lrb4NuWSKmU0m2g8P4ETz8YXxX9v1OkMK9363F GJFdE2D7ImvLiiCUQstdNFqD4iK/qQRpyefms= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786090; x=1713390890; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qTzjP1Nv4ThzlLlE1Ju5kdcsL0LhZGtnYro6XcnlOmk=; b=hdJBICvnUmwmcngFl+g2qCtX+HTJIcbMaZcDHqPpmgQFcNRblmyX6sbq03+PDHCm5l 9QR/XQQYI1RBaHzmxUOo05S8dTSGyu6KsOyU3mRXb8CAeCAkRRaFZj6tSauuwQAyWLma ZBwO0Bv4DimZgpTRpLFOkLckwb20o46zeXPC2XZGgxoCF6FTO6Q/tY5N3hAnRq5vNyH7 y4AHAVwR+WL5Jid/kAlugfAB+mCHLtD+wUFFBYYDkAI7B18ztOFwA1mJ0LSyV/XiDpjn pbpx8aASTUjQkkUjq2vse1q+PrhtEQ6FOaP4jSNanUCssrYe5oH6/StnfHTOyvhEDfSO jmEA== X-Forwarded-Encrypted: i=1; AJvYcCXh3yWUl5vuu+wPP3owK8AGqQCp90pC4WGOaWC9uxSrJbOZ2N4pH3QNdaQEAhYUS1iijgn5fExaSgnxzhf19rhyQBJFMHhs+qGXFzU= X-Gm-Message-State: AOJu0YydRq7tYn7ZA6mXEqCoA/HyjA6M8Wc2OMifuJ50ymbIeXSLF3CS tAdPP7tCm547u+sj0M7hN1J4DK0UkTJjjWLAfR300ZhbMAFZf2nj9hSDw88BNvIz8TMl+TsnbxL 1QQ== X-Google-Smtp-Source: AGHT+IHLvqSrxvThaEcLle6Xam6RG78CJ3NyLYmwXsqsdgP3jJ/C4bjd1BGbbwL3hfA5aXl4iG7EWw== X-Received: by 2002:a05:622a:34d:b0:435:18b:d78 with SMTP id r13-20020a05622a034d00b00435018b0d78mr4122157qtw.29.1712786089958; Wed, 10 Apr 2024 14:54:49 -0700 (PDT) Received: from denia.c.googlers.com (188.173.86.34.bc.googleusercontent.com. [34.86.173.188]) by smtp.gmail.com with ESMTPSA id kg26-20020a05622a761a00b00434c1eedb0esm67330qtb.36.2024.04.10.14.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:54:49 -0700 (PDT) From: Ricardo Ribalda Date: Wed, 10 Apr 2024 21:54:43 +0000 Subject: [PATCH 6/6] media: touchscreen: sur40: convert le16 to cpu before use Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240410-smatch-v1-6-785d009a852b@chromium.org> References: <20240410-smatch-v1-0-785d009a852b@chromium.org> In-Reply-To: <20240410-smatch-v1-0-785d009a852b@chromium.org> To: Mauro Carvalho Chehab , Yasunari Takiguchi , Jean-Christophe Trotin , Lars-Peter Clausen , Dmitry Torokhov Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 Smatch found this issue: drivers/input/touchscreen/sur40.c:424:55: warning: incorrect type in argument 2 (different base types) drivers/input/touchscreen/sur40.c:424:55: expected int key drivers/input/touchscreen/sur40.c:424:55: got restricted __le16 [usertype] blob_id Signed-off-by: Ricardo Ribalda --- drivers/input/touchscreen/sur40.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index ae3aab4283370..5f2cf8881e724 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c @@ -421,7 +421,7 @@ static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input) if (blob->type != SUR40_TOUCH) return; - slotnum = input_mt_get_slot_by_key(input, blob->blob_id); + slotnum = input_mt_get_slot_by_key(input, le16_to_cpu(blob->blob_id)); if (slotnum < 0 || slotnum >= MAX_CONTACTS) return;