It's a minor issue, but the code would be a little clearer if it were made explicit that the function always succeeds.
julia On Wed, 14 Oct 2015, kbuild test robot wrote: > CC: kbuild-...@01.org > CC: de...@driverdev.osuosl.org > TO: Oleg Drokin <gr...@linuxhacker.ru> > CC: "Greg Kroah-Hartman" <gre...@linuxfoundation.org> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > staging-testing > head: 2d893537569948120332184bbea29c743f9951d9 > commit: 02176031cd6db041a8b3916364df82b8708da3fc [992/1026] > staging/lustre/ldlm: Remove intent policies handler. > :::::: branch date: 12 days ago > :::::: commit date: 12 days ago > > >> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_lock.c:1540:14-16: > >> Unneeded variable: "rc". Return "ELDLM_OK" on line 1578 > > git remote add staging > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > git remote update staging > git checkout 02176031cd6db041a8b3916364df82b8708da3fc > vim +1540 drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_lock.c > > d7e09d039 Peng Tao 2013-05-02 1534 ldlm_error_t > ldlm_lock_enqueue(struct ldlm_namespace *ns, > d7e09d039 Peng Tao 2013-05-02 1535 struct > ldlm_lock **lockp, > d7e09d039 Peng Tao 2013-05-02 1536 void > *cookie, __u64 *flags) > d7e09d039 Peng Tao 2013-05-02 1537 { > d7e09d039 Peng Tao 2013-05-02 1538 struct ldlm_lock *lock = *lockp; > d7e09d039 Peng Tao 2013-05-02 1539 struct ldlm_resource *res = > lock->l_resource; > d7e09d039 Peng Tao 2013-05-02 @1540 ldlm_error_t rc = ELDLM_OK; > d7e09d039 Peng Tao 2013-05-02 1541 > bf6d21539 Arnd Bergmann 2015-09-27 1542 lock->l_last_activity = > ktime_get_real_seconds(); > d7e09d039 Peng Tao 2013-05-02 1543 > d7e09d039 Peng Tao 2013-05-02 1544 lock_res_and_lock(lock); > 02176031c Oleg Drokin 2015-10-01 1545 if (lock->l_req_mode == > lock->l_granted_mode) { > d7e09d039 Peng Tao 2013-05-02 1546 /* The server returned > a blocked lock, but it was granted > d7e09d039 Peng Tao 2013-05-02 1547 * before we got a > chance to actually enqueue it. We don't > d7e09d039 Peng Tao 2013-05-02 1548 * need to do anything > else. */ > d7e09d039 Peng Tao 2013-05-02 1549 *flags &= > ~(LDLM_FL_BLOCK_GRANTED | > d7e09d039 Peng Tao 2013-05-02 1550 > LDLM_FL_BLOCK_CONV | LDLM_FL_BLOCK_WAIT); > d1c0d446d Julia Lawall 2014-09-01 1551 goto out; > d7e09d039 Peng Tao 2013-05-02 1552 } > d7e09d039 Peng Tao 2013-05-02 1553 > d7e09d039 Peng Tao 2013-05-02 1554 ldlm_resource_unlink_lock(lock); > d7e09d039 Peng Tao 2013-05-02 1555 > 02176031c Oleg Drokin 2015-10-01 1556 /* Cannot happen unless on the > server */ > 02176031c Oleg Drokin 2015-10-01 1557 if (res->lr_type == LDLM_EXTENT > && !lock->l_tree_node) > 02176031c Oleg Drokin 2015-10-01 1558 LBUG(); > d7e09d039 Peng Tao 2013-05-02 1559 > d7e09d039 Peng Tao 2013-05-02 1560 /* Some flags from the enqueue > want to make it into the AST, via the > d7e09d039 Peng Tao 2013-05-02 1561 * lock's l_flags. */ > f2145eae3 Bruce Korb 2013-07-23 1562 lock->l_flags |= *flags & > LDLM_FL_AST_DISCARD_DATA; > d7e09d039 Peng Tao 2013-05-02 1563 > 02176031c Oleg Drokin 2015-10-01 1564 /* > 02176031c Oleg Drokin 2015-10-01 1565 * This distinction between > local lock trees is very important; a client > d7e09d039 Peng Tao 2013-05-02 1566 * namespace only has > information about locks taken by that client, and > d7e09d039 Peng Tao 2013-05-02 1567 * thus doesn't have enough > information to decide for itself if it can > d7e09d039 Peng Tao 2013-05-02 1568 * be granted (below). In this > case, we do exactly what the server > d7e09d039 Peng Tao 2013-05-02 1569 * tells us to do, as dictated > by the 'flags'. > 02176031c Oleg Drokin 2015-10-01 1570 */ > 0c279f4d9 Oleg Drokin 2015-10-01 1571 if (*flags & > (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED)) > d7e09d039 Peng Tao 2013-05-02 1572 > ldlm_resource_add_lock(res, &res->lr_waiting, lock); > d7e09d039 Peng Tao 2013-05-02 1573 else > d7e09d039 Peng Tao 2013-05-02 1574 ldlm_grant_lock(lock, > NULL); > d7e09d039 Peng Tao 2013-05-02 1575 > d7e09d039 Peng Tao 2013-05-02 1576 out: > d7e09d039 Peng Tao 2013-05-02 1577 unlock_res_and_lock(lock); > d7e09d039 Peng Tao 2013-05-02 @1578 return rc; > d7e09d039 Peng Tao 2013-05-02 1579 } > d7e09d039 Peng Tao 2013-05-02 1580 > d7e09d039 Peng Tao 2013-05-02 1581 > > :::::: The code at line 1540 was first introduced by commit > :::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file > system client support > > :::::: TO: Peng Tao <bergw...@gmail.com> > :::::: CC: Greg Kroah-Hartman <gre...@linuxfoundation.org> > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel