Received: by 10.213.65.68 with SMTP id h4csp1319834imn; Mon, 19 Mar 2018 00:17:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELt3OjjulRtl3xCtgw+8d+Fr75kJCWsmLTQl4Sp8l+BKk+B5piyB+ksEEvkPVxPB1a3QbSgn X-Received: by 2002:a17:902:8a93:: with SMTP id p19-v6mr4850265plo.285.1521443833693; Mon, 19 Mar 2018 00:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521443833; cv=none; d=google.com; s=arc-20160816; b=AMrVjHiOOICZcHRlqv1jc9yb+jZL6TtCC4Y2JmKWMgXAFszpS7/GR8mkv342pJdUc9 r3xSemPKnYU/AsazskaXTk56VU7Im9l/7gGeGR4fKWt/LGFlltE6mQEG/enc9OuyEHgL AQTpoFlNO0FpFlPJc3zZuMuCNL9cRhoIBcOv4pP2iFEF06bvFMbRDrvx0fz7Ynt7psvY KyubzSPUkUQIhXoLd4l9igw8VUG7nOvEtZqMab4ezI/3OiyJAaFCxE/OnRFyvk8s0mYH klD5lv32GEK+COeSTUvtekQ/4Ku9saRUhzFMYZTcEblF3SzzOyK4Kbt/iBdq3BtApyGx sWzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=j/JtFB6/HRGztBhfpwZC84ogyZxT9S+2g6kPg5Bhz+k=; b=0ugtT5Wfj5h6mkI9CCZL5IXuJk2HknQ+Rxs+Y4WT0OeqylFfqvRiYe9Cp1baDDmmXd voJdw+qrp7POchKv838iMsPvKml+D7Vji2WpQ2/+nNrFivJlVaILzabghLUmvm7Xm/wo ohs80U45tdW9ibQqVb2Bv+GVb7SwYLqwUr5uZnE0rIRKtXAHqlHxl0d9Hvucp1bXOoS8 MwKKIqxmHiRl+uNz7W3mkCNiljySSKAZcKcKT9Wsf8siekl3yiKICApcsEwIUnmg2QX8 Ubz1uYF6Tzm8YGikQ5eGneVMDgvd2Qj1Z+Ry+4cOhb4IN7xyvIe4lt3UrZWVRysu+u+2 cCZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=QmxvqP+4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si12133718plz.562.2018.03.19.00.16.59; Mon, 19 Mar 2018 00:17:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=QmxvqP+4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932316AbeCSHPP (ORCPT + 99 others); Mon, 19 Mar 2018 03:15:15 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:35218 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755339AbeCSHPL (ORCPT ); Mon, 19 Mar 2018 03:15:11 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2J7Bj3H018540; Mon, 19 Mar 2018 07:15:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=j/JtFB6/HRGztBhfpwZC84ogyZxT9S+2g6kPg5Bhz+k=; b=QmxvqP+4XrJImy25ujat3G493WnGzRsEeslOIgDtbW3wwaflfur+WNsOkkqRufjBncbd j4YCR0wfh5ICcYnCRm+MzXxjEEVFAc3TeIQukaLPhP3Op1GhgomUec8mircpfDWIhVOl 3+LqFFQJR/VPoYkxAnELAsYK/KtSZTPVBo6jzJ4NV2YKJWjzRyFfDC757C3Uv2pO6cSZ wl5PvBoT/HPqChYdrscEFp16ipOzDwd7SxJ7XO1/89vgyJhvzrUCNfepBI+ni6zwHfTK dm01v8Qprjwes2rp6Wby6lNIan3od8CtsQpxKCAFxzHOxiN6PHLK8aPuDyILceQcCtHP tQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2gt8kug0b0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Mar 2018 07:15:01 +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 w2J7EkdI014091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Mar 2018 07:14:46 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2J7Einw032395; Mon, 19 Mar 2018 07:14:45 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 19 Mar 2018 00:14:44 -0700 Date: Mon, 19 Mar 2018 10:14:35 +0300 From: Dan Carpenter To: Ji-Hun Kim Cc: mchehab@kernel.org, gregkh@linuxfoundation.org, arvind.yadav.cs@gmail.com, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: Re: [PATCH] staging: media: davinci_vpfe: add error handling on kmalloc failure Message-ID: <20180319071435.svpg72uomxfc6hoj@mwanda> References: <1521176303-17546-1-git-send-email-ji_hun.kim@samsung.com> <20180316083234.yq7a4rx6w35amflu@mwanda> <20180319042457.GB2915@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180319042457.GB2915@ubuntu> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8836 signatures=668693 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=732 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803190007 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 19, 2018 at 01:24:57PM +0900, Ji-Hun Kim wrote: > > 1294 } else if (to && !from && size) { > > 1295 rval = module_if->set(ipipe, NULL); > > 1296 if (rval) > > 1297 goto error; > > > > And here again goto free_params. > > > > 1298 } > > 1299 kfree(params); > > 1300 } > > 1301 } > > 1302 error: > > 1303 return rval; > > > > > > Change this to: > > > > return 0; > Instead of returning rval, returning 0 would be fine? It looks that should > return rval in normal case. > In the proposed code, the errors all do a return or a goto so "rval" would be zero here. Then the error path would look like: err_free_params: kfree(params); return rval; } regards, dan carpenter