Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5dbd147f authored by zijunzhao's avatar zijunzhao Committed by Zijun Zhao
Browse files

RESTRICT AUTOMERGE: Fix the error and make the argument nonnull

When trying to add nullability annotations to arguments in aosp/2381752,
conflicts come up.
See detail in https://android-build.googleplex.com/builds/pending/P47788031/aosp_bramble-userdebug/latest/view/logs/build.log

Bug: b/245972273
Test: atest mtp_ffs_handle_test
Change-Id: I841c57a404dbd0ee143257fe9106e3bcecbc8b3d
Merged-In: I841c57a404dbd0ee143257fe9106e3bcecbc8b3d
(cherry picked from commit 8ee5768b)
parent 673c81eb
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -362,10 +362,12 @@ int MtpFfsHandle::waitEvents(struct io_buffer *buf, int min_events, struct io_ev


void MtpFfsHandle::cancelTransaction() {
void MtpFfsHandle::cancelTransaction() {
    // Device cancels by stalling both bulk endpoints.
    // Device cancels by stalling both bulk endpoints.
    if (::read(mBulkIn, nullptr, 0) != -1 || errno != EBADMSG)
    void *buf = malloc(sizeof(char));
    if (::read(mBulkIn, buf, 0) != -1 || errno != EBADMSG)
        PLOG(ERROR) << "Mtp stall failed on bulk in";
        PLOG(ERROR) << "Mtp stall failed on bulk in";
    if (::write(mBulkOut, nullptr, 0) != -1 || errno != EBADMSG)
    if (::write(mBulkOut, buf, 0) != -1 || errno != EBADMSG)
        PLOG(ERROR) << "Mtp stall failed on bulk out";
        PLOG(ERROR) << "Mtp stall failed on bulk out";
    free(buf);
    mCanceled = true;
    mCanceled = true;
    errno = ECANCELED;
    errno = ECANCELED;
}
}