Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3708542pxj; Mon, 21 Jun 2021 04:58:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznO/Sgdo5JQtq+VvU4+xIf9v7YOLZZqvYHdy+OgRtUZ7m9jaoBgaTvGeNSUmlZuuXZB/xr X-Received: by 2002:a17:906:4fc6:: with SMTP id i6mr16061377ejw.472.1624276699113; Mon, 21 Jun 2021 04:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624276699; cv=none; d=google.com; s=arc-20160816; b=gNdZN0VMl1I4Ti9sE72wqNDp7FgMp20lBwl3uXKbEmdatFZVzQZUADOA1izIh5ZPOk qheYM2WCjkKb/0+LyaY3FJjQdG9Sk76SRRHbCnSqfLn/MOpjbn2ns9wZJCP8mTQfO15P IK8N7+6ASvmZNZvJTdVXemZsP3OC5yqw3cF6g5ChH/9dRSmYo7hsRTnlbcDnoOj9KOhp +g0njDL33ssb9DCcb9RXdVVMwsdxqzJP+3Ojpi5aOfIXEQ2y+rt2LA4yTU+PR73u/UAD ZZTaS9QbSkoIq0HxlGX0JFH+FGu6mNqdLkgy0KkrhgdQAfwKV3az9xGDJbSfoVvb3wCm M8hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=Ll4NAI9AIqreV3VF7S9YUwkr0TrY9P4Zyh+zQggnpg4=; b=yDSFgWAdnZ/iNpbi4wvsL2O2TX5LFkQ3Oa3D2RUVbJWioXpKqSc56+BsIFK5h0cGur JKouqUbUJOcAsYWBIzwyevWNX3s+k50jLR548JwGeAn32w/zPfB1tWIUDdXO02RgEXqO 91MVtCICBXuEi4Tl3cYU4f0gcawxxBpwEK4ycwZes9G1f7I+BRSiZtockCQRuFVWFO7P CqBWru8eCeIoKHsIOJ6owXC0Gu4c1bSi6llb5XCPFUXNGGfaC9ktKsqamA54XMTDsoem nrYdIkr8VL97HFoXM+br6INHxQUZe8zrMbV6sx2wxktPQ5QspXyNTlWvxK3LutM7BwF6 GSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=M2VJW0El; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ia24si6928609ejc.99.2021.06.21.04.57.56; Mon, 21 Jun 2021 04:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=M2VJW0El; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbhFUL7K (ORCPT + 99 others); Mon, 21 Jun 2021 07:59:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:34234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbhFUL7H (ORCPT ); Mon, 21 Jun 2021 07:59:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2496461153; Mon, 21 Jun 2021 11:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624276613; bh=uwGsDLBM94wlH08xSFR21Av3pUOHYUbttrYJhv47Jjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M2VJW0ElDZvi62c5dBfx9jvQeL4z7PgZ24MY/B4Gb4D4A9bPE3i/woCKhLWFDED/7 4HwBf5ohJMa7Jjax54eCixgLNbbCGdUMxO/ozyGkNeEBllEtguytwhg/2uciWVfDWX W1gPbrqazNlRHC3cBWMd8tFqaLxTDbts4L6En3vbStVOFskX2rMP31nWK0Tc8pPVY5 es1rJo4furoAdzcvdXoy1coexag8DjbaU0fqyJlYr9izu6+BPQgdbTAT61Nvar/kwi lb+SxQ+TMZHWxVIPO0lnzLk6UF7/t6JhfPCN5R0xmc5Q6N2YqekaMSidPm48kvvd3A wggMwDJy/JgCg== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1lvIXq-000Hco-Vr; Mon, 21 Jun 2021 13:56:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 3/5] media: v4l2-flash-led-class: drop an useless check Date: Mon, 21 Jun 2021 13:56:47 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As pointed by smatch: drivers/media/v4l2-core/v4l2-flash-led-class.c:264 v4l2_flash_s_ctrl() error: we previously assumed 'fled_cdev' could be null (see line 197) It is too late to check if fled_cdev is NULL there. If such check is needed, it should be, instead, inside v4l2_flash_init(). On other words, if v4l2_flash->fled_cdev() is NULL at v4l2_flash_s_ctrl(), all led_*() function calls inside the function would try to de-reference a NULL pointer, as the logic won't prevent it. So, remove the useless check. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-flash-led-class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c index 10ddcc48aa17..a1653c635d82 100644 --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c @@ -194,7 +194,7 @@ static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c) { struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; - struct led_classdev *led_cdev = fled_cdev ? &fled_cdev->led_cdev : NULL; + struct led_classdev *led_cdev = &fled_cdev->led_cdev; struct v4l2_ctrl **ctrls = v4l2_flash->ctrls; bool external_strobe; int ret = 0; -- 2.31.1