From patchwork Fri Aug 31 13:20:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10583685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40C81112B for ; Fri, 31 Aug 2018 13:20:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3504E2B68D for ; Fri, 31 Aug 2018 13:20:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 293E82B86C; Fri, 31 Aug 2018 13:20:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8B372B68D for ; Fri, 31 Aug 2018 13:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbeHaR2H (ORCPT ); Fri, 31 Aug 2018 13:28:07 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:42052 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727265AbeHaR2H (ORCPT ); Fri, 31 Aug 2018 13:28:07 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7VDITBW110682; Fri, 31 Aug 2018 13:20:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=TI+FxNOvpvwtRLsS52T4yl/SJzBsuR08hLDqQqo8AkY=; b=HhMjPYXf+5UxqfBN20i2unFicdeBixFwnNcbQIgzbgRBZZmCvXIIrsvHgqoXpN5sl6mr huxYedt+nJyvuHK6ar7iGNsCbMFUHcEyCpQnDv8wxk71cC3tf7KhjX4660D8Mx7bGdqD BXtE8yo5LWBkeHqExYevxY3YdFh7XZ3n+zuVFceF+wq0v1yv49DZ71JYcSQju45yeg/b f8UDp0DN7rIBgMzUxZhkN6uZeGFBV8Y8WnknjHrF6t+70kaDE2ga+UPtjVZgdXTfL6UZ P8MR4MOs0Vl18lWEuQMO7vVxCLsvsBcZYX4vyJZHXeyG2FPYbGrqThDJptNufU9gThWS 3Q== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2m2yrqu7h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Aug 2018 13:20:26 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w7VDKPEA025050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Aug 2018 13:20:25 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w7VDKPOH005905; Fri, 31 Aug 2018 13:20:25 GMT Received: from kili.mountain (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 31 Aug 2018 06:20:24 -0700 Date: Fri, 31 Aug 2018 16:20:18 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab , Sakari Ailus Cc: linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2] media: sr030pc30: remove NULL in sr030pc30_base_config() Message-ID: <20180831132018.bbrvi2vt4vatyojj@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180831124221.3kuamslh4xw3vjt7@valkosipuli.retiisi.org.uk> X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9001 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808310140 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This code doesn't check for NULL consistently and it generates a Smatch warning: drivers/media/i2c/sr030pc30.c:575 sr030pc30_base_config() error: we previously assumed 'info->pdata' could be null (see line 572) Fortunately, "info->pdata" can't be NULL to that check can be removed. The other thing is that if "ret" is an error code here, then we don't want to do the next call to cam_i2c_write(), so actually let's flip that test around and return the error. This is more of a theoretical issue than something which is likely to affect real life. Signed-off-by: Dan Carpenter --- v2: just remove the check Thanks Sakari Ailus for your review. diff --git a/drivers/media/i2c/sr030pc30.c b/drivers/media/i2c/sr030pc30.c index 2a4882cddc51..66d952624731 100644 --- a/drivers/media/i2c/sr030pc30.c +++ b/drivers/media/i2c/sr030pc30.c @@ -569,7 +569,7 @@ static int sr030pc30_base_config(struct v4l2_subdev *sd) if (!ret) ret = sr030pc30_pwr_ctrl(sd, false, false); - if (!ret && !info->pdata) + if (ret) return ret; expmin = EXPOS_MIN_MS * info->pdata->clk_rate / (8 * 1000);