Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752080AbbLMOA1 (ORCPT ); Sun, 13 Dec 2015 09:00:27 -0500 Received: from mout.web.de ([212.227.15.14]:63804 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751666AbbLMOAZ (ORCPT ); Sun, 13 Dec 2015 09:00:25 -0500 Subject: [PATCH 7/7] staging: lustre: Rename a jump label for module_put() calls To: Andreas Dilger , Greg Kroah-Hartman , Oleg Drokin , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org References: <566ABCD9.1060404@users.sourceforge.net> <566D7733.1030102@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <566D79EC.6050104@users.sourceforge.net> Date: Sun, 13 Dec 2015 15:00:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566D7733.1030102@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:4zXA+aY2CGRGc7I4az7+hIPKW0/aWdHSq8OppUJekh7xrmgfGwh XiDRBMnKegYytbBCypVD5GoOvOkkiJLDpj5D907UAPG9KrtS3escZMROMPjQLOjSljQMwRF DIiaVJFikuIBRd2T7KSuC5o8vbPs3em3bBfLAzY62FT6jCZZ6rdmfUcXDOZb0dKLHDhYAvM 9/df4eJsjqR/Nic+SuWLQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:ZPkBrV1bGDY=:8XTUnXorE6dw2onWMWtuay 7N7WtZMJeI68mwapqzqY8/esC9LFFljiNma2SxhetgrwwEcp/ui/PEma9FPbxAdX53agCn4nb Swh1RmAtBQ3zN+2XUW1hCRMT73yeigTA4WrVkUULut99ZxwY/8o26jEbIazoo4Bekx5VLEbYc fmZa2kj505Hpf5oMI21GaSWZvEOodehjd7Ixvt1vgK0xGvDOAiVOIYFBgNEkFmNu2ZxwKHRHh 8iwylpMvZmtJr54WyoZfj8zHPvCeyaq7ycoh+fcEDiy0vrpFlcnkYhAb+tyq8bwZSEraJUDFS 7iJTgJGhZxO+nOQY8P2EQhbHmuVmIvCcVY9ZnIWrHzljWui/gXGLa9ZjpXghnQJzMf+wG322Q JkR9zgQIZ1C8K79MCzFR+k54da0GVaGoHwsLtrf7/aHdidJi6ZYjisYxgpfqaOBpGEDy5089g Yco7mh8jJpalOjKsDCCviJhEEC/8ItcKxquDfhxugy32bmOGENlEjOlNdmx+qjhzs4cmuH3/0 sQvKVqnC7MPaJaQgNzMF1q2dokl4kscs0oDmGE5X60qkFgamwQjQmuYMbinoH8FOQ7Cw3vL4c i0DSjoNKvHNQ2x+XPMk5CiKxQGtoaneBvYjD1J2YsWqRki4o88JIQlST4p6MTeW5irLKBKyM7 FCTK7rLrmxZekYRn9IIokfZbLC6qryqAB9MCYyFjjyecOJTqU1SmNx5PdiQNLBIiFte/eC9OR XvBP4u/paLJPUerKLppnmcAA8EaDJQWecJGOSR2yLbQgRl2jVU2oudQOq4m6Ig1JlT0do59Ap NKoqS9B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8602 Lines: 314 From: Markus Elfring Date: Sun, 13 Dec 2015 14:05:57 +0100 This issue was detected by using the Coccinelle software. Choose a jump label according to the current Linux coding style convention. I suggest to improve this implementation detail by the reuse of a script like the following for the semantic patch language. @rename_jump_label exists@ identifier target != put_module, work; type return_type; @@ return_type work(...) { ... when any goto -target +put_module ; ... when any -target +put_module : module_put(...); ... when any } Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/llite/lloop.c | 8 ++-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 52 ++++++++++++------------- drivers/staging/lustre/lustre/osc/osc_request.c | 24 ++++++------ 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 420d391..ebeef3b 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -484,14 +484,14 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, error = -EBUSY; if (lo->lo_state != LLOOP_UNBOUND) - goto out; + goto put_module; mapping = file->f_mapping; inode = mapping->host; error = -EINVAL; if (!S_ISREG(inode->i_mode) || inode->i_sb->s_magic != LL_SUPER_MAGIC) - goto out; + goto put_module; if (!(file->f_mode & FMODE_WRITE)) lo_flags |= LO_FLAGS_READ_ONLY; @@ -500,7 +500,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, if ((loff_t)(sector_t)size != size) { error = -EFBIG; - goto out; + goto put_module; } /* remove all pages in cache so as dirty pages not to be existent. */ @@ -542,7 +542,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, down(&lo->lo_sem); return 0; -out: +put_module: /* This is safe: open() is still holding a reference. */ module_put(THIS_MODULE); return error; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 2085ba6..eaeca9a 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -1734,7 +1734,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, switch (cmd) { case OBD_IOC_CHANGELOG_SEND: rc = mdc_ioc_changelog_send(obd, karg); - goto out; + goto put_module; case OBD_IOC_CHANGELOG_CLEAR: { struct ioc_changelog *icc = karg; struct changelog_setinfo cs = { @@ -1745,47 +1745,47 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, rc = obd_set_info_async(NULL, exp, strlen(KEY_CHANGELOG_CLEAR), KEY_CHANGELOG_CLEAR, sizeof(cs), &cs, NULL); - goto out; + goto put_module; } case OBD_IOC_FID2PATH: rc = mdc_ioc_fid2path(exp, karg); - goto out; + goto put_module; case LL_IOC_HSM_CT_START: rc = mdc_ioc_hsm_ct_start(exp, karg); /* ignore if it was already registered on this MDS. */ if (rc == -EEXIST) rc = 0; - goto out; + goto put_module; case LL_IOC_HSM_PROGRESS: rc = mdc_ioc_hsm_progress(exp, karg); - goto out; + goto put_module; case LL_IOC_HSM_STATE_GET: rc = mdc_ioc_hsm_state_get(exp, karg); - goto out; + goto put_module; case LL_IOC_HSM_STATE_SET: rc = mdc_ioc_hsm_state_set(exp, karg); - goto out; + goto put_module; case LL_IOC_HSM_ACTION: rc = mdc_ioc_hsm_current_action(exp, karg); - goto out; + goto put_module; case LL_IOC_HSM_REQUEST: rc = mdc_ioc_hsm_request(exp, karg); - goto out; + goto put_module; case OBD_IOC_CLIENT_RECOVER: rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1, 0); if (rc < 0) - goto out; + goto put_module; rc = 0; - goto out; + goto put_module; case IOC_OSC_SET_ACTIVE: rc = ptlrpc_set_import_active(imp, data->ioc_offset); - goto out; + goto put_module; case OBD_IOC_POLL_QUOTACHECK: rc = mdc_quota_poll_check(exp, (struct if_quotacheck *)karg); - goto out; + goto put_module; case OBD_IOC_PING_TARGET: rc = ptlrpc_obd_ping(obd); - goto out; + goto put_module; /* * Normally IOC_OBD_STATFS, OBD_IOC_QUOTACTL iocontrol are handled by * LMV instead of MDC. But when the cluster is upgraded from 1.8, @@ -1798,7 +1798,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, if (*((__u32 *) data->ioc_inlbuf2) != 0) { rc = -ENODEV; - goto out; + goto put_module; } /* copy UUID */ @@ -1806,24 +1806,24 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, min_t(size_t, data->ioc_plen2, sizeof(struct obd_uuid)))) { rc = -EFAULT; - goto out; + goto put_module; } rc = mdc_statfs(NULL, obd->obd_self_export, &stat_buf, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (rc != 0) - goto out; + goto put_module; if (copy_to_user(data->ioc_pbuf1, &stat_buf, min_t(size_t, data->ioc_plen1, sizeof(stat_buf)))) { rc = -EFAULT; - goto out; + goto put_module; } rc = 0; - goto out; + goto put_module; } case OBD_IOC_QUOTACTL: { struct if_quotactl *qctl = karg; @@ -1832,7 +1832,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, oqctl = kzalloc(sizeof(*oqctl), GFP_NOFS); if (!oqctl) { rc = -ENOMEM; - goto out; + goto put_module; } QCTL_COPY(oqctl, qctl); @@ -1844,26 +1844,26 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, } kfree(oqctl); - goto out; + goto put_module; } case LL_IOC_GET_CONNECT_FLAGS: if (copy_to_user(uarg, exp_connect_flags_ptr(exp), sizeof(*exp_connect_flags_ptr(exp)))) { rc = -EFAULT; - goto out; + goto put_module; } rc = 0; - goto out; + goto put_module; case LL_IOC_LOV_SWAP_LAYOUTS: rc = mdc_ioc_swap_layouts(exp, karg); - goto out; + goto put_module; default: CERROR("unrecognised ioctl: cmd = %#x\n", cmd); rc = -ENOTTY; - goto out; + goto put_module; } -out: +put_module: module_put(THIS_MODULE); return rc; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 3a56fb7..3ee1ff8 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -2611,7 +2611,7 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, len = 0; if (obd_ioctl_getdata(&buf, &len, uarg)) { err = -EINVAL; - goto out; + goto put_module; } data = (struct obd_ioctl_data *)buf; @@ -2619,13 +2619,13 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, if (sizeof(*desc) > data->ioc_inllen1) { obd_ioctl_freedata(buf, len); err = -EINVAL; - goto out; + goto put_module; } if (data->ioc_inllen2 < sizeof(uuid)) { obd_ioctl_freedata(buf, len); err = -EINVAL; - goto out; + goto put_module; } desc = (struct lov_desc *)data->ioc_inlbuf1; @@ -2643,39 +2643,39 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, if (err) err = -EFAULT; obd_ioctl_freedata(buf, len); - goto out; + goto put_module; } case LL_IOC_LOV_SETSTRIPE: err = obd_alloc_memmd(exp, karg); if (err > 0) err = 0; - goto out; + goto put_module; case LL_IOC_LOV_GETSTRIPE: err = osc_getstripe(karg, uarg); - goto out; + goto put_module; case OBD_IOC_CLIENT_RECOVER: err = ptlrpc_recover_import(obd->u.cli.cl_import, data->ioc_inlbuf1, 0); if (err > 0) err = 0; - goto out; + goto put_module; case IOC_OSC_SET_ACTIVE: err = ptlrpc_set_import_active(obd->u.cli.cl_import, data->ioc_offset); - goto out; + goto put_module; case OBD_IOC_POLL_QUOTACHECK: err = osc_quota_poll_check(exp, karg); - goto out; + goto put_module; case OBD_IOC_PING_TARGET: err = ptlrpc_obd_ping(obd); - goto out; + goto put_module; default: CDEBUG(D_INODE, "unrecognised ioctl %#x by %s\n", cmd, current_comm()); err = -ENOTTY; - goto out; + goto put_module; } -out: +put_module: module_put(THIS_MODULE); return err; } -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/